Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Adding GA code if multiple tracking objects are there

I can add GA code to my video setup like this.. If I have a single tracker object (
var playerInstance = jwplayer("myElement");
file: "/uploads/example.mp4",
image: "/uploads/example.jpg",
ga: {
idstring: "title",
label: "mediaid"

But how can I add this if I have 2 tracker objects? The event is firing only for auto object. Please help how to add it for other object also.

3 Community Answers


JW Player Support Agent  
2 rated :

I found a code example for how to do this on Google’s web site at

ga('create', 'UA-xxxxxxx-1', 'auto');
ga('create', 'UA-xxxxxx-1', 'auto', {'name': 'newTracker'});  // Second GA account tracker as documented by Google
ga('send', 'pageview');
ga('newTracker.send', 'pageview'); // Send page view for new tracker.

Our player will use the ga: {} block in your code to send events to the first tracker listed. You can then use custom API events to send individual pings to the second tracker:

	ga('newTracker.send', 'event', 'JW Player Video Completes', jwplayer().getPlaylistItem().title, document.URL);

	if (jwplayer().getFullscreen() == true) {
		ga('newTracker.send', document.URL, jwplayer().getPlaylistItem().title, 'Fullscreen: True');

Sruthi N

0 rated :

Hi Todd,
Thanks a lot. The above solution worked fine. Events are firing now for both trackers.

We want to play videos in page to open in lightbox.
Tried this with different plugins but not successful. Looking forward for any help. Thank you


JW Player Support Agent  
0 rated :

My suggestion for lightboxes is to do the following:

1) Load the player on the page as soon as the page loads with the player height and width both set to 0
2) In the function that gets called when the viewer launches the lightbox, call jwplayer().resize(‘width’,‘height’) and jwplayer().play()
3) In the function that gets called with the lightbox is closed, call jwplayer().pause(true) and jwplayer().resize(‘0’,‘0’) to hide the player again.

This question has received the maximum number of answers.