Skip to content

Instantly share code, notes, and snippets.

@caefer
Created November 25, 2011 08:52
Show Gist options
  • Save caefer/1393074 to your computer and use it in GitHub Desktop.
Save caefer/1393074 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
var _gaq = _gaq || [];
(function(_gaq, n, v){
var e = 'my-variables', /* slot index */ i=1, /* scope */ s=2;
(function(fn) {
var d = document;
if(d.addEventListener) d.addEventListener('DOMContentLoaded', function(){ d.removeEventListener('DOMContentLoaded', arguments.callee, false); fn(); }, false);
else if(d.attachEvent) d.attachEvent('onreadystatechange', function(){ if(d.readyState === "complete"){ d.detachEvent('onreadystatechange', arguments.callee); fn(); }});
})(function(){
if(window._gaq instanceof Array){
_gaq.push(['_setCustomVar', i, n, v, s]);
_gaq.push(['_trackEvent', e, n, v, 0, true]);
}else{
try{
var t = _gat._getTracker("{{ site.google_analytics_id }}");
t._setCustomVar(i, n, v, s);
t._trackEvent(e, n, v, 0, true);
} catch(err) { console.log(err); }
}
});
})(_gaq, 'CV Key', 'CV Value');
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment