Tracking how users are interacting with your embedded Vimeo videos is now easier than ever thanks to Google Tag Manager (GTM). After reading my colleague Nicky Yuen’s post about tracking user interaction with embedded YouTube videos, I felt inspired to write a similar post about Vimeo videos. So without further ado, here is the step by step guide to setting up Vimeo tracking using Google Tag Manager (GTM).

For a live Google Tag Manger experience online, sign up for our Virtual Analytics Summit, Analytics Rising.

Step 1 – Create your variables

Google Analytics Tracking ID

This variable will hold the Google Analytics tracking ID. This is how Google
Tag Manager will know which property it should to send information to.

  • Variable Name
    • UA – Property ID
  • Variable Type
    • Constant
  • Variable Config
    • Value: UA-XXXXXX-X (replace with your property tracking ID)

UA_PropertyID

Vimeo Video Present

This variable will track whether or not a Vimeo video is embedded on the page. It will return TRUE if a video is embedded on the page, and FALSE if there is no video embedded. This is important because we do not want to to execute our script library and potentially delay the page load time unless we are sure that it is needed.

  • Variable Name
    • cj – Vimeo Video Present
  • Variable Type
    • Custom Javascript
  • Variable Config
    • Custom Javascript:
//this function checks for the presence of an embedded Vimeo video
//if one or more videos are present, return true, otherwise return false

function () {
  for (var e = document.getElementsByTagName("iframe"), x=0; x < e.length; x++) {
    if (/^https?:\/\/player.vimeo.com/.test(e[x].src)) {
      return true;
    }
  }
  return false;
}
 chrome_2016-10-17_12-57-24
 

Data Layer Category

We need to define a variable which will hold the event category that our tracking script will push into the dataLayer.

  • Variable name:
    • dL – eventCategory
  • Variable type:
    • Data Layer Variable
  • Variable configuration:
    • Data Layer Variable Name: eventCategory
    • Data Layer Version: Version 2
dl_EventCategory

Data Layer Action

We need to define a variable which will hold the event action that our tracking script will push into the dataLayer.

  • Variable name:
    • dL – eventAction
  • Variable type:
    • Data Layer Variable
  • Variable configuration:
    • Data Layer Variable Name: eventAction
    • Data Layer Version: Version 2
DL_EventAction

Data Layer Label

Now, we need to define a variable which will hold the event label that our tracking script will push into the dataLayer.

  • Variable name:
    • dL – eventLabel
  • Variable type:
    • Data Layer Variable
  • Variable configuration:
    • Data Layer Variable Name: eventLabel
    • Data Layer Version: Version 2
DL_Event_Label

Step 2 – Create Your Triggers

Vimeo Event Trigger

  • Trigger Name
    • Vimeo Video
  • Trigger Event Type
    • Custom Event
  • Trigger Fires On
    • Event Name: vimeo
VimeoVideo

Vimeo Present Trigger

This trigger will fire when the page is fully loaded (gtm.dom) and when our previously created variable detects an embedded Vimeo video and returns a value of “true”.

  • Trigger Name
    • Vimeo Present
  • Trigger Event Type
    • Custom Javascript
  • Trigger Fires On
    • “cJ – Vimeo Video Present”  >  equals  >  true
VimeoPresent

Step 3 – Configure Tag

Google Analytics Event Tag

This will be the tag that sends all of the wonderful information we are capturing with our listener script into our Google Analytics account.

  • Tag name
    • UA – Vimeo Event
  • Tag product
    • Google Analytics
  • Tag type
    • Universal Analytics
  • Tag config
    • Tracking ID: {{UA – Property ID}}
    • Track Type: Event
    • Category: {{dL – eventCategory}}
    • Action: {{dL – eventAction}}
    • Label: {{dL – eventLabel}}
  • Tag fires on
    • Vimeo Video
UA_VimeoEvent

Vimeo Listener Tag

This tag does all of the behind-the-scenes work to push valuable information about the video to the dataLayer. We will only want to fire this tag when there is a Vimeo video actually embedded on the page, which is why we created a special trigger for it in the previous step.

  • Tag name
    • Vimeo Listener
  • Tag product
    • Custom HTML
  • Tag Configuration
    • HTML: (found at bottom of page)
  • Tag fire on
    • Vimeo Present
Vimeo_listener

Step 4 (optional): Bonus Information About the Video

The Vimeo tracking code not only lets us listen in to play/pause/etc events, it also exposes some additional data points about the video which can be passed through to Google Analytics as custom dimensions enabling some more advanced reporting. The additional data points are as follows:

  • Author
  • Author profile URL on vimeo.com
  • Upload date
  • ID
  • Title

To capture these data points, we’ll need to create some variables to pull the information from the data layer, and also modify our Google Analytics event tag to pass these data points through as custom dimensions.

The variables

Since the above extra data points are stored in the data layer, we will need to create some “Data Layer Variables”. Here are the “keys” that can be used to capture this information:

  • vimeo_playerID
  • vimeo_playerTitle
  • vimeo_playerAuthor
  • vimeo_playerAuthorURL
  • vimeo_playerUploadDate

The Setup (you’ll need to create one for each “key” listed
above)

  • Variable name:
    • dL – vimeo_playerID
  • Variable type:
    • Data Layer Variable
  • Variable configuration:
    • Data Layer Variable Name: vimeo_playerID
    • Data Layer Version: Version 2
DL_vimeo_playerID

The Modified Google Analytics Tag

We will take the existing Google Analytics tag that we configured in Step 3, and simply pass through some additional information as custom dimensions. For this example, I will pass through all of the additional data points in order to show how that would be achieved.

Make sure that these custom dimensions are created within your Google Analytics Administrator settings before you start sending data into them, otherwise the data will not be captured. Google Analytics does not automatically create custom dimensions.

  • Tag name
    • UA – Vimeo Event
  • Tag product
    • Google Analytics
  • Tag type
    • Universal Analytics
  • Tag config
    • Tracking ID: {{UA – Property ID}}
    • Track Type: Event
    • Category: {{dL – eventCategory}}
    • Action: {{dL – eventAction}}
    • Label: {{dL – eventLabel}}
      • More settings
      • Custom Dimensions
        • Index 1: {{dL – vimeo_playerID}}
        • Index 2: {{dL – vimeo_playerTitle}}
        • Index 3: {{dL – vimeo_playerAuthor}}
        • Index 4: {{dL – vimeo_playerAuthorURL}}
        • Index 5: {{dL – vimeo_playerUploadDate}}
  • Tag fires on
    • Vimeo Video
UA_vimeo_event

The Code Snippet – Google Docs

Click here to get the custom Javascript markup required for Vimeo video tracking!

The Code Snippet – Pastebin

Click here to get the custom Javascript markup required for Vimeo video tracking!

Message Sent

Thank you for registering.

Cardinal Path hosted a live session to connect with you and answer all your questions on Google Analytics.
Get all the expertise and none of the consultancy fees in this not-to-be-missed, rapid-fire virtual event.

Thank you for submitting the form.

Thank you for submitting the form.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Click here to download access the tool.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Success!
Your message was received.

Thank you.

Thank you for registering.

Cardinal Path is continuing with its series of free training. Next we are conducting training on Google Data Studio. Check it out here.

Message Sent

Thank you for registering.

Thank you for your submission.

Your request has been submitted and a rep will reach out to you shortly.

Message Sent

Thank you for your interest.

Thank you for registering.

You should receive a confirmation email from GoToWebinar with your unique webinar login information. If you do not receive this email or have trouble logging in to the event, please email asmaa.mourad@cardinalpath.com.

Thank you for subscribing!

You're now looped into the world's largest GMP resource hub!

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for registering.​

Paid media spend by Government websites increased a whopping 139% YoY in 2020.

2020 Online Behavior Live Dashboard

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

2020 Online Behavior Live Dashboard

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Success! Thank you
for reaching out.