Closed GoogleCodeExporter closed 9 years ago
Inserting the tracking code twice on a page like you've show will not work and
is not supported. The reason you're getting the result you're seeing is because
of the following line in the snippet:
i['GoogleAnalyticsObject'] = r;
Where `r` is the name of the analytics object.
By using the snippet twice, with the code you've show, you're essentially doing
this:
i['GoogleAnalyticsObject'] = 'first_namespace_ga';
i['GoogleAnalyticsObject'] = 'second_namespace_ga;
So, once the Google Analytics script downloads, the reference to
`first_namespace_ga` is completely lost, and the script only transforms the
second object into a usable function.
If you want to track multiple different properties on the same page, you can do
that as described here:
https://developers.google.com/analytics/devguides/collection/analyticsjs/advance
d#multipletrackers
I'm going to close this issue since it's not actually a bug. If you have
additional questions on how to implement multiple trackers, please ask them on
Stack Overflow using the google-analytics tag or on the official Google group
for analytics.js:
https://groups.google.com/forum/#!forum/google-analytics-analyticsjs
Original comment by philipwa...@google.com
on 6 Aug 2014 at 11:42
[deleted comment]
Ok I did not see the race condition on which the GoogleAnalyticsObject is
overwritten before any analytics library code is loaded.
Too bad the analytics tag did not foresee this use case. Well thanks anyway for
your answer.
Original comment by laur...@adyoulike.com
on 7 Aug 2014 at 12:23
Original issue reported on code.google.com by
laur...@adyoulike.com
on 1 Aug 2014 at 10:48