Does CAOS allow tracking across subdomains?

Yes, but it requires adding a snippet of code to your theme's functions.php file or adding it to a seperate plugin.

To enable (conversion) tracking across subdomains when Download File (Advanced Settings) is set to analytics.js, insert the following code to one of the aforementioned locations:

function ffwpress_caos_set_cookie_domain($config) {
    $config['cookieDomain'] = 'auto';
    return $config;
}

add_filter('caos_analytics_ga_create_config', 'ffwpress_caos_set_cookie_domain');

When Download File (Advanced Settings) is set to gtag.js, use the following:

function ffwpress_caos_set_cookie_domain($config) { 
    $config['cookie_domain'] = 'auto';
    return $config;
}
add_filter('caos_gtag_config', 'ffwpress_caos_set_cookie_domain');

(Conversion) tracking across subdomains isn't possible when Snippet Type (Basic Settings) is set to Minimal Analytics.

Is your subdomain not using CAOS/WordPress?

That's fine! You should just make sure that the generated cookies have the same name.

To avoid ad blockers CAOS has a different cookieName set by default: caosLocalGa

All you need to do is make sure that the cookie generated by CAOS matches the cookie name of the other Google Analytics tracking snippet. The default cookie name for Google Analytics is _ga.

This code replaces the code mentioned in the previous chapter.

When Download File (Advanced Settings) is set to analytics.js:

function ffwpress_caos_set_cookie_domain($config) {
    $config['cookieName']    = '_ga'; // Change this to the value your other tracking code uses.
    $config['cookieDomain'] = 'auto';
    return $config;
}

add_filter('caos_analytics_ga_create_config', 'ffwpress_caos_set_cookie_domain');

When Download File (Advanced Settings) is set to gtag.js:

function ffwpress_caos_set_cookie_domain($config) {
    $config['cookie_name']    = '_ga'; // Change this to the value your other tracking code uses. 
    $config['cookie_domain'] = 'auto';
    return $config;
}
add_filter('caos_gtag_config', 'ffwpress_caos_set_cookie_domain');
Shopping Cart
  • Your cart is empty.