CDN for Joomla!

Apparent issue with CDN enabled and Google Analytics tracking then not "working".

1 year 4 days ago #75625

Online+Course Info's Avatar Online+Course Info

We noticed a drop off in Google Analytics reported visitors (it could happen!), but the difference was so great we looked at the server logs and notice no significant difference between when GA reported reasonable numbers of users and when almost none were reported. We tracked it back to around October 5th but also noticed that the Google Tag Manager code (which loads GA) was still loading correctly. So, we turned off CDN for Joomla but noticed that the CDN was still being used in the home page's resources, so cleared the Joomla cache - no CDN usage now AND GA started reporting users. Enabling CDN for Joomla again (and clearing the Joomla cache), meant CDN being used but again GA saying no visitors.

Any thoughts?

Thanks

1 year 4 days ago #75626

Peter van Westen's Avatar Peter van Westen Admin

Do you have locally running Google Analytics scripts?
See if you see any weird urls concerning the analytics scripts in your websites html output when CDN for Joomla! is on.

1 year 4 days ago #75627

Peter van Westen's Avatar Peter van Westen Admin

Also check your browser's console to see if you get any javascript errors when CDN for Joomla! is active.

11 months 4 weeks ago #75702

Online+Course Info's Avatar Online+Course Info

"Locally running GA scripts" - no.

"Wierd URLs" - no. Just the same path portion of the URIs with the host replaced by the CDN.

"Browser console" - in both cases (with CDN enabled and disabled), there are JS errors in mootools and jQuery - but the same errors.

What I do notice (using the Chrome Dev Tools Network tab) is that in the CDN-disabled case, the GA "sequence" is:
1) load Google Tag Manager (gtm.js) ("initiator" is the page requested)
2) load Google Analytics (ga.js) ("initiator" is gtm.js, as expected)
3) load a Google gif ("initiator" is ga.js)

In the CDN-enabled case only 1) occurs (still with an HTTP response code of 200).

It's hard to see why the difference in behaviour has much to do with CDN for Joomla, but the only change taking place here is enabling / disabling it, so there would appear to be a strong correlation.

Thanks

11 months 4 weeks ago #75703

Peter van Westen's Avatar Peter van Westen Admin

Do you have this online so I can take a look?
You can use the 'Hidden text' button to hide the confidential information.

11 months 4 weeks ago #75714

Online+Course Info's Avatar Online+Course Info

Confidential information:
(hidden)

11 months 4 weeks ago #75715

Peter van Westen's Avatar Peter van Westen Admin

Can you give me (super) admin access so I can take a look with CDN for Joomla! on?

11 months 4 weeks ago #75720

Online+Course Info's Avatar Online+Course Info

Confidential information:
(hidden)

11 months 4 weeks ago #75722

Peter van Westen's Avatar Peter van Westen Admin

All urls seem to be converted fine on your website.
So CDN for Joomla! is doing what it is supposed to do.

THe javascript errors you have on your site are not connected to CDN for Joomla!

And also: I do not see any Google Analytics scripts being loaded on that page with and without CDN for Joomla! switched on.

11 months 4 weeks ago #75753

Online+Course Info's Avatar Online+Course Info

Hi Peter,

Thanks for investigating. As you can see from my earlier post, GA (analytics.js) is loaded via GTM (see also support.google.com/analytics/answer/6163791?hl=en ) - so, yes, GA does not appear directly in the HTML source for our page, but it is loaded via GTM, which itself does load with & without CDN for Joomla being enabled. It suggests to me that the problem I'm experiencing is due to one or more differences between the page handling with/without CDN enabled:
- loading sequence of on-page JS;
- error handling causing a JS error that occurs (in the failure case) not to be shown in the browser console

I'm currently looking at the JS execution sequence of gtm.js in the two cases - it's hard work since the Google developers are more competent than me!

Mark

11 months 4 weeks ago #75755

Peter van Westen's Avatar Peter van Westen Admin

You could try adding gtm.js to the files to ignore in the CDN for Joomla! system plugin settings.

11 months 4 weeks ago #75765

Online+Course Info's Avatar Online+Course Info

Ah - I had assumed the "Ignore files" field was purely for file types given the default entry was ttf,woff,woff2. Having now added gtm.js, the problem is worked around - in some sense, "solved", since gtm.js is being loaded from Google and not locally (and, therefore, not via the CDN, when enabled), so CDN behaviour is not different with gtm.js excluded.

Thanks for your help Peter.

11 months 4 weeks ago #75768

Peter van Westen's Avatar Peter van Westen Admin

My pleasure :)