YouTube

The YouTube plugin captures data about YouTube videos embedded on a web page, such as plays, pauses, and percentage viewed. This data populates reports in the YouTube space in Analytics 10.

Events tracked by the YouTube plugin

Impression events
An event is sent when a page with an embedded YouTube video loads. One event per embedded video is sent.
Action events
Events are sent when a visitor plays, pauses, resumes, finishes, or selects a frame in a video.
Progress events
Events are sent when a visitor passes the 25%, 50% and 75% milestones in a video. (The Action events for play and finish represent 0% and 100% progress, respectively.)

Adding the YouTube plugin

You must have the Webtrends Javascript tag version 10.2 to use the YouTube plugin. Add the plugin using this code:

          window.webtrendsAsyncInit=function(){  
                    var dcs=new Webtrends.dcs().init({  
                              dcsid:"YOUR_WEBTRENDS_DCSID_HERE"  
                              ,timezone:YOUR_TIMEZONE_HERE  
                              ,plugins:{  
                                        yt:{  
                                                  //required  
                                                  src:"//s.webtrends.com/js/webtrends.yt.js",   
                                                  //optional  
                                                  mode: "manual",  
                                                  dcsid: "YOUR_WEBTRENDS_YOUTUBE_DCSID"  
                                        }  
                              }  
                              }).track();  
          };

Enabling necessary APIs

Do one of the following:

Enabling the YouTube JavaScript Player API
Add the enablejsapi=1 option to the query string of the video URL.
Note: For more information on enabling the YouTube Javascript API, see: YouTube JavaScript Player API Reference
Enabling the YouTube Player API for iframe Embeds
See the Getting Started section in YouTube Player API Reference for <iframe> Embeds, specifically the code to load the iFrame Player API code asynchronously:
var tag = document.createElement('script');
tag.src = "//www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

Plugin Configuration Options

src
Required. Specifies the location of the plugin. You can use the hosted version, //s.webtrends.com/js/webtrends.yt.js, or host it on your server.
dcsid
Optional. Sends the Youtube data to a different Webtrends data source than the other events on the tagged page. If no value is provided, the main tag's dcsid is used.
mode
Optional. Controls how the plugin tracks iFrame embedded players.
  • automatic: (default) Use this mode if the tagged page is only using static iFrame embedded video players. Do not use it if the page is instantiating its own YT.Player objects to control or track the player dynamically.
  • manual: Use this mode if the page is instantiating its own YT.Player objects. In this case, the plugin cannot automatically track the players, so the YT.Player objects will need to be passed to the plugin. The code sample shows how to do this using the Webtrends.addYTPlayer() method.
    Note: Only players in the ready state should be passed to this method.
    var player1 = new YT.Player('ytplayer1', {  
             height: '390',  
             width: '640',  
             videoId: 'u1zgFlCw8Aw',  
             playerVars: {   
                  fs: 0  
             },  
             events: {  
                       'onReady': function(event){Webtrends.addYTPlayer(event.target);},  
             }  
        });
    
Note: For more information on YT.Player objects and the difference between the two types of iFrame embedded players, see: YouTube Player API Reference for <iframe> Embeds

Webtrends parameters sent by the YouTube plugin

Parameter Example value Description When sent

WT.dl

40 or 41

Sent for all YouTube events.

All events. Impression events have a value of 40, all others have a value of 41.

WT.clip_id

fQZnmZmvPXo

The YouTube ID of the currently playing video.

All events.

WT.clip_n

Webtrends%20Promo%20Video

The title of the currently playing video.

All events.

WT.clip_ev

Play

A description of the event being tracked.

Action events only; not sent on progress events. See Events tracked by the YouTube plugin.

WT.soc_action

Youtube: Play

A description of the event being tracked. The difference between this and WT.clip_ev is that WT.clip_ev is used in video specific reports, while WT.soc_action is used in broader social reports which may include other types of actions.

Action events only; not sent on progress events. See Events tracked by the YouTube plugin.

 

WT.soc_content

Webtrends%20Promo%20Video

The title of the currently playing video (used in conjunction with WT.soc_action).

Action events only; not sent on progress events. See Events tracked by the YouTube plugin.

WT.clip_secs

48

The time in the video when an event occurs.

Action and Progress events only. See Events tracked by the YouTube plugin.

WT.clip_perc

25

The percentage of the video played: 25, 50, 75, or 100.

Only Progress events. See Events tracked by the YouTube plugin.

WT.clip_t

Flash

Flash or HTML5, depending on what type of player is being used.

All events.

WT.clip_q

medium

The quality setting of the player.

All events.

WT.yt_tv

10.2.15

The version of the YouTube plugin.

All events.