Difference between revisions of "YouTube Video Tracking"
m |
m |
||
(6 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
== How to implement == | == How to implement == | ||
− | # [[Install_the_tracking_snippet|Install ConversionRuler Tracking] normally on your site. | + | # [[Install_the_tracking_snippet|Install ConversionRuler Tracking]] normally on your site. |
− | # If [[jQuery]] is already being used, add the following script after jQuery is loaded: <pre><nowiki><script type="text/javascript" src="http://www.conversionruler.com/bin/youtube.js"></script></nowiki></pre> | + | # If [[jQuery]] is already being used, add the following script after [[jQuery]] is loaded: <pre><nowiki><script type="text/javascript" src="http://www.conversionruler.com/bin/youtube.js"></script></nowiki></pre> |
− | # Edit your sites actions to add the following actions: | + | # If [[jQuery]] is not being used, add this line to the top of your page, before the youtube.js script above: <pre><nowiki><script src="http://code.jquery.com/jquery-1.10.1.min.js"></script></nowiki></pre> |
− | + | # Edit your sites actions to add the following actions (You can use custom names - see below): | |
− | + | #* "play" - When a video is played by the user | |
− | + | #* "pause" - When a video is paused by the user | |
− | + | #* "seek" - When a video is seeked by the user | |
+ | #* "end" - When a video reaches the end | ||
# YouTube videos will now be tracked using the named actions as described below | # YouTube videos will now be tracked using the named actions as described below | ||
+ | |||
+ | == How actions are tracked == | ||
+ | |||
+ | Actions are tracked with the following parameters: | ||
+ | |||
+ | * First text field: Full URL of video | ||
+ | * Second text field: ID of video (e.g. UJ53Js0YKZM) | ||
+ | * Third text field: Seconds offset in the video where the action occurred | ||
+ | |||
+ | == Using alternate names for actions == | ||
+ | |||
+ | In case you wish to use an alternate naming or numbering scheme for your actions in ConversionRuler, the script allows you to map the default names to new ones. To do so, create a global variable in JavaScript to map the names from the defaults to your chosen names. The variable used for this is called '''cr_youtube_actions''', e.g. | ||
+ | |||
+ | <nowiki><script type="text/javascript"> | ||
+ | var cr_youtube_actions = { | ||
+ | "play": "yt-play", | ||
+ | "pause": "yt-pause", | ||
+ | "seek": "yt-seek", | ||
+ | "end": "yt-end" | ||
+ | }; | ||
+ | </script></nowiki> | ||
+ | |||
+ | The above code will map each action on the left to the new action on the right. So when the play button is recorded, the action "yt-play" will record with ConversionRuler. | ||
+ | |||
+ | == See also == | ||
+ | |||
+ | * [[Install the tracking snippet]] | ||
+ | * [[Can ConversionRuler track Flash advertisements?]] | ||
+ | * [[Named Actions]] | ||
+ | |||
+ | Feature added August 19th, 2013 at 6PM Eastern Daylight Time. | ||
+ | |||
+ | [[Category:ConversionRuler Installation]] | ||
+ | [[Category:ConversionRuler Tracking]] | ||
+ | [[Category:ConversionRuler Features]] | ||
+ | [[Category:ConversionRuler JavaScript Functions]] | ||
+ | [[Category:ConversionRuler]] |
Latest revision as of 22:01, 19 August 2013
Tracking YouTube videos is now handled seamlessly with an add-on library from ConversionRuler.
Contents
Requirements
Tracking YouTube Videos requires the following:
- Your site must use the jQuery library on the pages in question
- ConversionRuler currently supports tracking of iframe YouTube videos only (this is the modern version)
- To track old-style YouTube videos, employ the technique for tracking Flash
How to implement
- Install ConversionRuler Tracking normally on your site.
- If jQuery is already being used, add the following script after jQuery is loaded:
<script type="text/javascript" src="http://www.conversionruler.com/bin/youtube.js"></script>
- If jQuery is not being used, add this line to the top of your page, before the youtube.js script above:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
- Edit your sites actions to add the following actions (You can use custom names - see below):
- "play" - When a video is played by the user
- "pause" - When a video is paused by the user
- "seek" - When a video is seeked by the user
- "end" - When a video reaches the end
- YouTube videos will now be tracked using the named actions as described below
How actions are tracked
Actions are tracked with the following parameters:
- First text field: Full URL of video
- Second text field: ID of video (e.g. UJ53Js0YKZM)
- Third text field: Seconds offset in the video where the action occurred
Using alternate names for actions
In case you wish to use an alternate naming or numbering scheme for your actions in ConversionRuler, the script allows you to map the default names to new ones. To do so, create a global variable in JavaScript to map the names from the defaults to your chosen names. The variable used for this is called cr_youtube_actions, e.g.
<script type="text/javascript"> var cr_youtube_actions = { "play": "yt-play", "pause": "yt-pause", "seek": "yt-seek", "end": "yt-end" }; </script>
The above code will map each action on the left to the new action on the right. So when the play button is recorded, the action "yt-play" will record with ConversionRuler.
See also
Feature added August 19th, 2013 at 6PM Eastern Daylight Time.