Skip to content

Instantly share code, notes, and snippets.

@chexton
Created August 30, 2013 12:06
Show Gist options
  • Select an option

  • Save chexton/6389195 to your computer and use it in GitHub Desktop.

Select an option

Save chexton/6389195 to your computer and use it in GitHub Desktop.
install-vero-bwm.js
//1. Put this on EVERY page, just before </head>
<script type="text/javascript">
var _veroq = _veroq || [];
_veroq.push(['init', { api_key: '65d6e9dded1c0eb25b4d963b150111934efd57c2'} ]);
(function() {var ve = document.createElement('script'); ve.type = 'text/javascript'; ve.async = true; ve.src = '//d3qxef4rp70elm.cloudfront.net/m.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ve, s);})();
</script>
//2. Put this on every page you know the user is logged in (/ you know their email, e.g. after they subscribe). Put it after #1
<script type="text/javascript">
_veroq.push(['user', {
id: 'customer@domain.com', // Required
email: 'customer@domain.com', // Required
age: 30
}]);
</script>
// Note that you can add extra attribute, in the example above 'age' is optional!
//3. This script is the code you use to track an event. You usually attach this to a button onclick or at the bottom of a page
<script type="text/javascript">
_veroq.push(['track', 'begins checkout']);
</script>
//4. You can also track meta-data / attributes, as below
<script type="text/javascript">
_veroq.push(['track', 'viewed product', {product_name: 'Product name', price: 250.00, product_url: 'http://www.blarney.com/product/1.html'}]);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment