Hi,
We have clojurescript code calling the google analytics api that is created on
a regular html page with the usual embed code, like this:
(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');
In a clojurescript file we have function to report pageviews like that:
(defnk init-analytics [analytics-account-id user-id account-id]
(.ga js/window "create" analytics-account-id "auto")
(.ga js/window "set" "&uid" (str user-id))
(.ga js/window "set" "dimension1" (str user-id))
(.ga js/window "set" "dimension2" (str account-id))
(.ga js/window "send" "pageview" (get-page)))
This works fine without the advanced compilation mode but fails on advanced
one. This code is being compiled to a munged name, in this case window.nc
instead of window.ga
I've tried to add to our extens file (we have other external libraries that
work fine) the follwoing:
var ga = function(args); but that doesn't help.
The closure compiler has externs for the analytics api but that seems like an
old one (old analytics API that is):
https://github.com/google/closure-compiler/blob/master/contrib/externs/google_analytics_api.js
Does someone ran into similar problem and can post a solution
Thanks
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.