Question

I have a site built using Magnolia CMS, and I need to add Google Analytics to its pages. I've installed the Google Analytics for STK module, and then followed the documentation.

Since this tracking number is for an account I don't have access, what can I do to test that this configuration is working? I've opened the page's source code, but don't see any reference to GA. Any ideas?

Was it helpful?

Solution

The Analytics module by default injects the necessary Javascript into your all.js file, which is built up on the fly from all the little bits of Javascript that the various templates, modules, etc. want to have available on the page. (Magnolia concatenates all of these files on the server side to help speed page load times by requiring a single HTTP connection for your Javascript instead of one for each piece of functionality that might go in a separate file.)

To see if the appropriate code is getting injected, look at your source and search for "js/all". This should show the URL for your aggregated Javascript. (If you're on an author instance, it will also have a big timestamp added to make sure that it doesn't get cached when you don't want it to.)

Follow that URL to view your aggregated Javascript, and then search for "UA-" within that code. (All of the google tracking IDs begin with "UA-".) If you find that, than the analytics module is indeed doing what it's meant to.

That said, the best way to be sure that it's working is to actually check it in Google analytics. If you don't have access to the real ID, you might set up a test one and use that for a couple of days and verify that you're getting the data you expect. (GA does take a bit of time to aggregate that data and show it in reports, so be patient.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top