Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

YouTube Video tracking through Adobe Launch?

Avatar

Level 4

Need to track the following events:

Video Start (how many times was play clicked?)
Video 2 sec played
Video 30 sec played
Video 25 % played
Video 50 % played
Video 75 % played
Video 100 % played
Video paused

 

How we can track it? Could you please help.

I used some YouTube extension as mentioned below but sometimes its working sometime not working.

kamleshmaddheshiya_0-1653049421379.png

kamleshmaddheshiya_1-1653050271677.png

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I had a similar issue with the Adobe plugins.... My solution, which is a bit odd, is a "Frankenstein" mix between GTM and Adobe.

 

I use GTM's YouTube Video trigger and built-in Video Variables to drive a custom html script tag. In this tag I set a window level object to hold the information about the video.. things like the title, id, status, % completed, etc. Then here is where I trigger a custom JS event.

 

<script>
  // initiate the custom event if not already present
  if (!videoTrackEventShared){
    var videoTrackEventShared;
    videoTrackEventShared = new Event('videoTrackEventShared');
  }

  // set variables based on build in vars (probably overkill, but I like to be able to easily swap out or manipulate things here, rather than in-line where I set the data
  var videoStatus = {{Video Status}};
  var videoTitle = {{Video Title}};
  var videoPercent = {{Video Percent}};
  var videoURL = {{Video URL}};
  var videoId = videoURL.substring(videoURL.indexOf("v=") + 2);

  // Set Window Object
  window.sharedVideoData = {"title":videoTitle, "videoId":videoId, "videoEvent":videoStatus, "videoPosition":videoPercent+"%"};

  // Dispatch Custom Event
    window.document.dispatchEvent(videoTrackEventShared);
</script>

GTM Trigger:

JDungan_0-1653055853635.png

 

 

In Adobe, I created a rule to listed for that JS event, then read the object and set my Adobe Analytics tracking that way. You could also in theory try and leverage the GTM data layer (I was having issues with that and for expedience reasons I just did my own thing).

 

Adobe Custom Code Event:

document.addEventListener('videoTrackEventShared', function (e) {
  trigger();
}, false);

Then I just pick up the values from the window.sharedVideoData with my Data Elements, and use them as I need in my Adobe tracking.

 

 

I have found this solution to be the most reliable solution for us.... though as I said, it's a bit of an odd solution... I just felt like the GTM YouTube trigger (with both YouTube and GTM being Google products) might be more apt to stay up-to-date and functional (though.. I don't have 100% faith in that), but since the YouTube API seems to constantly change which was causing me a lot of headaches before, and this solution has now been in place for over a year and is still working, I think it's pretty solid....

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

I had a similar issue with the Adobe plugins.... My solution, which is a bit odd, is a "Frankenstein" mix between GTM and Adobe.

 

I use GTM's YouTube Video trigger and built-in Video Variables to drive a custom html script tag. In this tag I set a window level object to hold the information about the video.. things like the title, id, status, % completed, etc. Then here is where I trigger a custom JS event.

 

<script>
  // initiate the custom event if not already present
  if (!videoTrackEventShared){
    var videoTrackEventShared;
    videoTrackEventShared = new Event('videoTrackEventShared');
  }

  // set variables based on build in vars (probably overkill, but I like to be able to easily swap out or manipulate things here, rather than in-line where I set the data
  var videoStatus = {{Video Status}};
  var videoTitle = {{Video Title}};
  var videoPercent = {{Video Percent}};
  var videoURL = {{Video URL}};
  var videoId = videoURL.substring(videoURL.indexOf("v=") + 2);

  // Set Window Object
  window.sharedVideoData = {"title":videoTitle, "videoId":videoId, "videoEvent":videoStatus, "videoPosition":videoPercent+"%"};

  // Dispatch Custom Event
    window.document.dispatchEvent(videoTrackEventShared);
</script>

GTM Trigger:

JDungan_0-1653055853635.png

 

 

In Adobe, I created a rule to listed for that JS event, then read the object and set my Adobe Analytics tracking that way. You could also in theory try and leverage the GTM data layer (I was having issues with that and for expedience reasons I just did my own thing).

 

Adobe Custom Code Event:

document.addEventListener('videoTrackEventShared', function (e) {
  trigger();
}, false);

Then I just pick up the values from the window.sharedVideoData with my Data Elements, and use them as I need in my Adobe tracking.

 

 

I have found this solution to be the most reliable solution for us.... though as I said, it's a bit of an odd solution... I just felt like the GTM YouTube trigger (with both YouTube and GTM being Google products) might be more apt to stay up-to-date and functional (though.. I don't have 100% faith in that), but since the YouTube API seems to constantly change which was causing me a lot of headaches before, and this solution has now been in place for over a year and is still working, I think it's pretty solid....

Avatar

Community Advisor

On the other hand, this means that you have two tag management systems running on the same web page.

Avatar

Community Advisor

True, but we had that anyway...  Our GA tracking is all done through GTM because business wants separation of concerns... also our AdOps people have access to GTM but not Adobe so that they can add remarketing pixels if needed (I wouldn't trust them in Adobe Launch due to the constant sprint work that is being deployed into our Dev environments - they already don't look before deploying in GTM) . A lot of people are probably using both for a similar reason.

 

I agree, if you don't already have GTM on your sites, it's not worth adding for this... but if you do, you can leverage it to your advantage.

Avatar

Community Advisor

@kamlesh-maddheshiya I am the developer of the YouTube Playback extension (your 2nd screenshot). What problems were you having with it? I'm happy to troubleshoot with you, perhaps over private message.

Avatar

Level 4

Thank you @yuhuisg. I would like to connect. Could you please help to tell, how and when we can connect. 

Email ID: seokamlesh22@gmail.com