Video tags can be triggered at any specific time during video playback. This is a very powerful feature which can be used in many ways.

Examples:

  • You can send an email to the user if he watched the video until the end (keep in mind a good practice - set the video tag time about 10 seconds before the end instead of the last second)
  • You can add the user to a specific e-mail campaign after he reaches some point in the video.

Requirements:

  • Zapier account
  • Vidalytics Zapier Integration (you can enable it from the “Integrations” tab in the dashboard)

There are two methods you can use: 

1. Via URL Parameter

Every video tag passes the “user_id” and “email” fields by default. Values for all fields are taken from the URL parameters. 

So for example, if your site URL is http://yoursite.com and you want to pass the “user_id” field value, then your link has to be http://yoursite.com?user_id=xyz

It is also possible to pass custom field values when the video tag is fired. To do this, you must register a field (or fields) for the video tag in your video settings. For example, you can add your custom field named “customField123”. Then, to pass its value when the video tag is fired, you need your URL to be similar to this one: http://yoursite.com?customField123=customValue

2. Via Embed Code (Advanced)

Another option is to pass field values through the embed code without using URL parameters. It is an advanced setup and requires JavaScript coding skills + the ability to get values from whatever third party platform you're using.

This is for all cases when passing param via URL is not possible or just not acceptable (like when using a landing page builder). 

  1. Go to your video settings, create your Video Tag and grab its ID.

                                          Your setup should look like this ^

2. Confirm your changes by clicking the “Publish” button on the top-right corner.

3. Now it’s time to customize your embed code. You can grab the default one by clicking on the “Embed / Share” button.

4. To override the default Vidalytics Player settings and pass your video tag field values, you need to create a custom JavaScript object and then pass it to the embed code. It must have the following structure: 

var vidalyticsCustomSettings = {
   plugins: {
       trigger: {
           triggers: {
               "gQ0EotDtTQXP3CQy": { // key must match Video Tag ID
                   params: {
                       customField: 'Custom Field Value', // key must match Video Tag Field Name
                       user_id: 'Custom User ID' // "user_id" (and "email") are registered by default so you don’t have to register them in the dashboard to make them work
                   }
               }
           }
       }
   }
};

 To pass email, you'd just have to add "email" field under "user_id" (or replace "user_id" with "email").

The Trigger UID + set param names should match the ones set in the Vidalytics dashboard, and you should set their values in the custom piece of JS above.

5. Then, replace a small part of embed code: 

"t.run(a)" has to be replaced with: "t.run(a, vidalyticsCustomSettings)".


6. Your final customized embed code with the video tag field values should be similar to this: 

Click image to enlarge


8. Now you can install this code on your site. Watch the video on your site until your tag is fired to push some test data to Zapier. 

It is important to do at least one test before going to Zapier. Without it, Zapier would not discover your video tag field setup.

Here is a sample of what your final code will look like. Feel free to use it, but make sure you change the tag ID and general embed script with your own so it works properly!

<script type="text/javascript">

var vidalyticsCustomSettings = {

   plugins: {

       trigger: {

           triggers: {

              "X8WimvbuOmXfdvEm": {                    

params: {

                       user_id: 'Custom User ID',

                       email: 'Email'

                   }

               }

           }

       }

   }

};

</script>

<div id="vidalytics_embed_ga6xMxNv6i8_0uQ7" style="width: 100%; position:relative; padding-top: 56.25%;"></div>

<script type="text/javascript">

(function (v, i, d, a, l, y, t, c, s) {

    y='_'+d.toLowerCase();c=d+'L';if(!v[d]){v[d]={};}if(!v[c]){v[c]={};}if(!v[y]){v[y]={};}var vl='Loader',vli=v[y][vl],vsl=v[c][vl + 'Script'],vlf=v[c][vl + 'Loaded'],ve='Embed';

    if (!vsl){vsl=function(u,cb){

        if(t){cb();return;}s=i.createElement("script");s.type="text/javascript";s.async=1;s.src=u;

        if(s.readyState){s.onreadystatechange=function(){if(s.readyState==="loaded"||s.readyState=="complete"){s.onreadystatechange=null;vlf=1;cb();}};}else{s.onload=function(){vlf=1;cb();};}

        i.getElementsByTagName("head")[0].appendChild(s);

    };}

    vsl(l+'loader.min.js',function(){if(!vli){var vlc=v[c][vl];vli=new vlc();}vli.loadScript(l+'player.min.js',function(){var vec=v[d][ve];t=new vec();t.run(a, vidalyticsCustomSettings);});});

})(window, document, 'Vidalytics', 'vidalytics_embed_ga6xMxNv6i8_0uQ7', 'https://fast.vidalytics.com/embeds/kpRgkfwv/ga6xMxNv6i8_0uQ7/');

</script>

Note that to test your Zaps, you can use emails with '+' signs, but they should be written as %2B if you are simply appending the email address on your URL for testing purposes.

Note:

The field tag is something you need to get from your CRM. It must be unique for each contact in your system. Also, it must match identically to what your CRM calls it (e.g. if they call it "contact_id" you must put that into our system exactly). You may be able to choose from more than one field over there, but it must be unique. The typical ones are email address (only one person can have the same email address) and contract id (or some variation of what your CRM calls contact id).

To set up your zap in Zapier, check out this article: 

How to Set Up the Zapier Integration

Did this answer your question?