Reputation: 11677
this is my new analytics code:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-000000-0', 'mysite.com');
ga('send', 'pageview');
</script>
I found in the analytics api, that I set a custom var like:
_gaq.push(['_setCustomVar',
1, // This custom var is set to slot #1. Required parameter.
'Items Removed', // The name acts as a kind of category for the user activity. Required parameter.
'Yes', // This value of the custom variable. Required parameter.
2 // Sets the scope to session-level. Optional parameter.
]);
but the variable "_gaq" is not defiend, and where do I place this code? my analytics is just after the tag
Upvotes: 1
Views: 173
Reputation: 117086
Universal Analytics doesn't have the .push it has a ga() function.
Also there are no custom variables in Universal Analytics. In Universal Analytics we get custom dimensions and metrics.
Your custom variables are pretty much the same as the new custom dimensions.
The main difference is that they are set up in the GA interface instead of via arguments to the old .push function.
ga('set', 'dimension1', 'Yes');
Set up or edit custom dimensions & metrics
Upvotes: 1