Reputation:
I've got an unusual Google API code snippet:
(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-XXXXXX-1', '192.168.8.101');
ga('send', 'pageview');
This looks very similar to the older variant, however, I can't find any reference to these API. I'm looking specifically for the analogues of:
_setCustomVar
_trackPageView
(is 'send', 'pageview'
equivalent to it?)_setDomainName
(I want to test it on a computer on the intranet / connected to the HTTP server running locally).Sorry, there was some confusion here. I've found the reference:
https://developers.google.com/analytics/devguides/collection/analyticsjs/domains
Here it is, for posterity, however, I can't find an analogue to _setCustomVar
and _setDomainName
.
UPDATE
I've found that (maybe) ga('set', { property : value });
will do the same as _setCustomVar
and that ga('create', 'UA-XXXXX-1', { 'cookieDomain': 'none' })
would be similar to the _setDomainName
. However, I still cannot get it to report anything when testing locally :(
Upvotes: 2
Views: 313
Reputation: 22834
You are correct, _setDomainName was replaced to be a property of create. This is useful because some people were calling _setDomainName after _trakPageview and it causes problems. So having it as a property avoid the confusion with ordering.
ga('create', 'UA-XXXXX-1', { 'cookieDomain': 'none' })
Also what were previously CustomVars are called custom metrics and dimensions. They are more powerfull in the sense that they are configured on the server side and you only send the values on the api call. Also now you can send metrics that will be aggregated.
The new API and these changes are part of a bigger update on the Google Analytics platform called Universal Analytics.
Note that in order to use the new tracking code your webproperty must be set to Universal Analytics. You can't change an old web property to be Universal Analytics (at least not yet). You are given the option to use Universal Analytics or not when you create a new Web Property.
Upvotes: 1