Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save reverentgeek/194ae4ecf0e0e1cf7b10429272acc69a to your computer and use it in GitHub Desktop.
Save reverentgeek/194ae4ecf0e0e1cf7b10429272acc69a to your computer and use it in GitHub Desktop.

Example Site Tracking Code

<script type="text/javascript">(function(e,t,o,n,p,r,i){e.visitorGlobalObjectAlias=n;e[e.visitorGlobalObjectAlias]=e[e.visitorGlobalObjectAlias]||function(){(e[e.visitorGlobalObjectAlias].q=e[e.visitorGlobalObjectAlias].q||[]).push(arguments)};e[e.visitorGlobalObjectAlias].l=(newDate).getTime();r=t.createElement("script");r.src=o;r.async=true;i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)})(window,document,"https://diffuser-cdn.app-us1.com/diffuser/diffuser.js","vgo");
  vgo('setAccount', '########');
  vgo('setTrackByDefault', true);
  vgo('process');
</script>

Implementation

The important item to identify in the example above is our ​vgo object ​which handles all of the variables for processing and loading our site tracking code. In order to set the email for the vgo object you will need to write a simple function to submit the email address to our site tracking code when a specific form is submitted on your site and reload the site tracking script. Here is an example using jQuery.

jQuery('form#####').submit(function() {
  var userEmail = jQuery("form###### input[type='email']").val();
  vgo('setEmail', userEmail);
  vgo('process');
});
@chimanSeyedhashemi
Copy link

Hi, what is "vgo"?
Should it be installed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment