Setting up tracking code for multiple Google Ads accounts on the same website
Every Google Ads account you add to ClickGUARD gets its own tracking code, so our goal is to make the website run the appropriate code based on the Google Ads account that generated the ad click.
Using Google Tag Manager? Get instructions here.
After successfully linking your Google Ads accounts with ClickGUARD and activating them, follow these steps to install tracking code on your website:
Here we're instructing Google Ads to add an additional parameter to final URLs generated for ads. We will use this parameter on your website to identify different Google Ads accounts.
In each Google Ads account you are using:
visit Settings > Account Settings
expand the “Tracking” section
add acc=ACCOUNT_ID to your Final URL suffix (if you already have parameters in your suffix, add the new one like this: &acc=ACCOUNT_ID)
Important: replace ACCOUNT_ID with the ID of the account in ClickGUARD. The end goal is to have each account with a different identifier in the final URL suffix: acc=GUHR78, acc=58GFFF...

To get the account ID in ClickGUARD, go to your Accounts page and grab it from the "ID" column of the respective Google Ads account:

In order for your website to be able to differentiate between clicks coming from different Google Ads accounts, make sure you install the following custom tracking code before your </body> tag ends:
<script>
var query = window.location.search.substring(1);
var cga = null;
var params = query.split("&")
for (var i=0;i<params.length;i++) {
var pair = params[i].split("=");
if(pair[0] == 'acc') cga = pair[1];
}
if (!cga) {
cga = window.localStorage.getItem('tmp_cg_cid');
} else {
window.localStorage.setItem('tmp_cg_cid', cga);
}
var cgs = document.createElement('script');
var src = 'https://io.clickguard.com/s/cHJvdGVjdG9y/' + cga;
cgs.setAttribute('src', src);
document.body.appendChild(cgs);
</script>
<script defer type="application/javascript">
(function () {
window.cg_convert = function (x, y) { if (window._cg_convert) window._cg_convert(x || null, y || null); else setTimeout(function () { cg_convert(x || null, y || null) }, 500); };
})();
</script>
You're all set.
Using Google Tag Manager? Get instructions here.
After successfully linking your Google Ads accounts with ClickGUARD and activating them, follow these steps to install tracking code on your website:
(1) Identify Google Ads accounts using the Final URL suffix
Here we're instructing Google Ads to add an additional parameter to final URLs generated for ads. We will use this parameter on your website to identify different Google Ads accounts.
In each Google Ads account you are using:
visit Settings > Account Settings
expand the “Tracking” section
add acc=ACCOUNT_ID to your Final URL suffix (if you already have parameters in your suffix, add the new one like this: &acc=ACCOUNT_ID)
Important: replace ACCOUNT_ID with the ID of the account in ClickGUARD. The end goal is to have each account with a different identifier in the final URL suffix: acc=GUHR78, acc=58GFFF...

To get the account ID in ClickGUARD, go to your Accounts page and grab it from the "ID" column of the respective Google Ads account:

(2) Install custom code on the website
In order for your website to be able to differentiate between clicks coming from different Google Ads accounts, make sure you install the following custom tracking code before your </body> tag ends:
<script>
var query = window.location.search.substring(1);
var cga = null;
var params = query.split("&")
for (var i=0;i<params.length;i++) {
var pair = params[i].split("=");
if(pair[0] == 'acc') cga = pair[1];
}
if (!cga) {
cga = window.localStorage.getItem('tmp_cg_cid');
} else {
window.localStorage.setItem('tmp_cg_cid', cga);
}
var cgs = document.createElement('script');
var src = 'https://io.clickguard.com/s/cHJvdGVjdG9y/' + cga;
cgs.setAttribute('src', src);
document.body.appendChild(cgs);
</script>
<script defer type="application/javascript">
(function () {
window.cg_convert = function (x, y) { if (window._cg_convert) window._cg_convert(x || null, y || null); else setTimeout(function () { cg_convert(x || null, y || null) }, 500); };
})();
</script>
You're all set.
Updated on: 24/02/2023
Thank you!