WordPress plugin
CAOS Pro: How Local gtag.js Hosting Works
CAOS Pro gives WordPress sites using Google Analytics control over how the tracking library is hosted and added. Enter your Measurement ID, then have CAOS place Google Analytics 4 tracking code in your theme’s header or footer, or add the code manually. CAOS downloads gtag.js to your server and keeps it updated through WordPress’ built-in Cron schedule.
CAOS Pro gives WordPress sites using Google Analytics control over how the tracking library is hosted and added. Enter your Measurement ID, then have CAOS place Google Analytics 4 tracking code in your theme’s header or footer, or add the code manually. CAOS downloads gtag.js to your server and keeps it updated through WordPress’ built-in Cron schedule.
Local files and tracking settings
You can save the downloaded file anywhere within the WordPress wp-content directory and serve it from your CDN. CAOS can preconnect to Google Analytics to reduce request latency, and downloaded files can be renamed to random strings to help avoid ad blockers. Settings also let you set the cookie expiry period, force-disable display capabilities, and track logged-in administrators.
For sites that mainly need basic pageview-focused analytics, Minimal Analytics 4 offers a lightweight alternative to Google Analytics’ default libraries.
Using CAOS with other plugins
Compatibility Mode lets other Google Analytics plugins use the locally hosted file. Listed examples include MonsterInsights Pro, ExactMetrics, Site Kit by Google, WooCommerce Google Analytics Integration, WooCommerce Google Analytics Pro, and Analytify.
CAOS also works with cookie notice plugins such as Complianz, CookieYes, WP Cookie Notice, Cookie Notice & Compliance, and Cookie Notice & Consent Banner. Cloudflare Compatibility Mode is available for sites using Cloudflare.
Privacy controls and affiliate links
For privacy-oriented analytics configurations, CAOS Pro includes Randomize Client ID, which provides each visitor with a fresh UUID or ClientID, and Stealth Mode, which uses a customized WordPress API to anonymize visitor data before sending it to Google’s servers. Pro also includes cloaked affiliate link tracking.
Set up the tracking workflow
- Install and activate CAOS Pro in WordPress.
- Enter your Google Analytics 4 Measurement ID.
- Choose the header, footer, or manual placement for the tracking code.
- Allow CAOS to download and save the local gtag.js file.
- Choose any needed library, compatibility, delivery, cookie expiry, or administrator tracking options.
- Review Randomize Client ID and Stealth Mode for your analytics configuration.
WordPress’ scheduled Cron process updates the locally hosted analytics file automatically.