CAKE Knowledge Base

YouTube Impression, Conversion & Event Tracking

Updated Jun 27, 2014

This article will cover the following:

- Step-by-step guide for how to track YouTube impressions, conversions and events


Integrating impression, conversion and event tracking into embedded Youtube videos is as easy as following the 2 steps below.  (This guide assumes you've setup your Advertiser, Offer, Affiliate and Campaign as well as having Events enabled in your system with the relevant events setup. )

In this scenario, you would

  1. Fire an impression when the video loads
  2. Call an Event when the user clicks play  
  3. Finally, fire a conversion pixel once the user has completed watching the video

While this may not mimick your current use case, the mechanics on setting this up should cover any variation of setup (ie calling a single impression pixel once the video has completed). 

Note:  Our focus is on Youtube's iframe API which is the most current embed option and the only option that supports both mobile and web.  Flash and javascript options are available but they do not support mobile display.

Step-by-step guide

  1. Insert the above code into the head of your page.  This code contains special functions for impression pixels, conversion pixels and events pixels.  Optionally you can remove these blocks of code if you are not tracking all three. 
  • IMPORTANT:  You will need to modify the iframe calls above to call your instance domain (ie change "" to ""

2.      Place your Youtube video player code on the page.  This code consist of a div (<div id="player"></div>) that can be placed any where you want the video to display on the page.  It also includes calls to the Youtube API to configure your video settings.  Finally, we have added our pixel calls to this code which are commented within the code.  Read on for formatting your pixel calls.  

This code will write the player to the page, call an impression pixel when the page is loaded, call an event when the user clicks play and call a conversion pixel when the video is finished.   Keep in mind the working example below is setup to track with CAKE's demo instance so some modifications will need to be made to make it work with your instance.

  1. More information on Google/Youtube's API documentation:
  2. CAKE pixel formatting and setup
    1. Impressions
      1. Once you've generated your pixel you will need to get the "E" calue to pass through the function (based on code above) 
        1. ckmImpression('E_VALUE_HERE');  (see line 23 above)
      2. In some cases your impression pixel may look like the image below.  If so you'll need to modify the impression call and impression fire to match.

      ii.    Events

              1. Once you've setup your Events you will need to generate your pixel and include the offer id and event id with your ckmEvent call

                        a. ckmEvent('OFFER_ID_HERE','EVENT_ID_HERE');  (see link 28 above)

     iii.    Conversions

              1. For conversions you simply need to include the offer id in the ckmConversion call

                        a. ckmConversion('OFFER_ID_HERE');

***Here is a working version with alerts being triggered for the impression, event and conversion: ***


Add your comment

E-Mail me when someone replies to this comment
Previous Article Twitter Feed not Working?
Next Article SOAP Posting Method