[CAOS] allows you to further optimize your sites’ usage of Google Analytics.Cody Arsenault (KeyCDN)
analytics.js file to your server. Then the file is updated automagically using WordPress’ integrated wp_cron() function.
How to Optimize Analytics in WordPress?
Why should I host analytics.js locally?
The Complete Analytics Optimization Suite for WordPress gives you the best of both worlds. After activation it automagically downloads the latest version of
Configure CAOS in WordPress
The basic configuration for CAOS is very easy. The basic settings are required for proper functioning of the plugin.
Enter your Google Analytics Tracking ID, For GDPR Compliance, decide when you want to allow tracking…
- Choose ‘Always’ if your blog doesn’t need to show a Cookie Notice or if you’ve configured Google Analytics to only collect anonymous data,
- Choose ‘when cookie is set’ or ‘when cookie has a value’ if you want to configure CAOS with a Cookie Notice.
Decide where you want to load the generated tracking code…
- Choose ‘Header’ for best performance. Because the tracking code is loaded before the rest of the page, you’re sure that all visitor data can be registered by Google Analytics,
- Choose ‘Add manually’ to maximize compatibility. If your theme or another plugin is preventing CAOS from adding the tracking code automatically, choose this option and copy the generated tracking code from the field underneath.
Choose between the default (synchonous, i.e. render blocking) tracking code or the asynchronous tracking code. If you haven’t already, remove any other previously installed Google Analytics plugins or manually inserted tracking code from your WordPress installation.
To tailor CAOS to your needs you can use the Advanced Settings. None of these are required settings and are strictly meant for advanced (WordPress) users.
- CAOS does not offer an Analytics Dashboard for WordPress or Enhanced Commerce tags/events. To implement these features, CAOS is fully compatible with Monster Insights, Analytify, WooCommerce GA Integration and ExactMetrics.
- Enable Stealth Mode to bypass Ad Blockers and secure Google Analytics’ accuracy.
- Choose to download
analytics.jstogether. Need help choosing?
- Set a ‘Cookie Expiry Period‘ if you want to let the Google Analytics-cookie expire after a set number of days.
- You can use the ‘adjusted bounce rate‘ if you want to filter out e.g. visitors that close their browser window within a set number of seconds. This can be useful if you offer short snippets of information on your blog that don’t trigger a user to continue reading other pages, such as StackOverflow.
- Expert Level: Disable all Display Features if you want to force disable any remarketing purposes set in your Google Analytics Dashboard.
- In some countries it is required to Anonymize the IP Address of your visitors e.g. Germany. For GDPR Compliance you should enable this option if you live in such a country.
- Expert Level: For testing purposes you could enable tracking logged in Administrators. Be warned that this can seriously alter your Analytics statistics.
Analytics.js/gtag.js/ga.js doesn’t exist or hasn’t been updated for more than two days.
CAOS throws this notice if analytics.js, gtag.js or ga.js (depending on your settings) does not exist, or hasn’t been updated for a while.
First off, check if the file exists. If not, trigger a manual update from within CAOS’ settings screen.
If it does exist, then it means that the scheduled update wasn’t able to run. This usually happens on low traffic sites (< 100 visitors/daily), because WP cron wasn’t able to properly finish its schedule.
Is your site a low traffic site? There’s no shame in that :-), but it probably means that not just CAOS’ scheduled jobs, but many of WordPress cronjobs aren’t able to run properly.
To work around this, you need to setup a so called real cronjob.
Replace WP’s Cron with a Real Cronjob
For this you’ll need SSH access to your server. If you don’t have this, contact your hosting provider and ask them to replace WordPress’ pseudo cron with a real cronjob.
- First you need to disable WordPress’ pseudo cron. To do this go to wp-config.php (located in the root of your WordPress install and add the following line right before the line that reads
/* That's all, stop editing! Happy blogging. */:
- Then, open up a terminal, login to your server and run
crontab- e. This will open up your cron editor. Then add the following:
*/5 * * * * wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
That’s it. From now on, WordPress’ cron will run every 5 minutes.
- How to use CAOS and Analytics with a Cookie Notice (GDPR)
- How to setup Google Analytics to be GDPR Compliant without a Cookie Notice
- How to Host Analytics.js Locally with CAOS and Cookie Notice for GDPR
- Leverage Browser Caching by Hosting Analytics Locally with Monster Insights' Wordpress Plugin
- Complete Guide to GDPR Compliance for Google Analytics in Wordpress
- What's the Difference Between analytics.js, gtag.js & ga.js?
- How to Bypass Ad Blockers with CAOS for Google Analytics
- How to integrate Google Optimize into CAOS
- How to Track Google Ads Conversions with CAOS
- How to Integrate Bookeo into Google Analytics using CAOS for WordPress
- How to Setup Adjusted Bounce Rate for Google Analytics in CAOS
- How to protect your Google Analytics data against Ad Blockers
- Super Stealth Upgrade is now 10x (!) Faster
Click here to go to the WordPress Repository and download Complete Analytics Optimization Suite