Starting with the upgrade from Dojo 1.6 to 1.7, my site tracking code seems to be throwing an error that I can't resolve. I've compared the API docs for 1.6 and 1.7 and don't see any significant differences.
My original code was a declarative widget near the end of <body>
:
<div data-dojo-type="dojox.analytics.Urchin"
data-dojo-props='acct: "UA-88003-8"'>
</div>
I have since tried a programmatic version like this from a script that is loaded manually in <head>
:
require(["dojox/analytics/Urchin"], function(ga) {
var analytics = new ga({acct: "UA-88003-8"});
});
Either way the error thrown looks something like this:
Uncaught TypeError: Object [object Object] has no method 'get' a.(anonymous function) ga.js:11 require.cache.dojox/analytics/Urchin._213.trackPageView dojo:15 require.cache.dojox/analytics/Urchin._213.GAonLoad dojo:15 require.cache.dojox/analytics/Urchin._213._gotGA dojo:15 (anonymous function) dojo:15 _310
I am using a custom build of Dojo, but this issue is easily replicated in control environment using stock Dojo libraries. Here is an example on JSFiddle.
What is the correct way to instantiate a GA tracker object using Dojo 1.7?