Set up Google Ads tagging to report your paid search activity correctly. You can set it up yourself in Google Ads, or let Infinity add the scripts and tracking template for you in the Infinity Platform. This guide covers both options, so you can choose the one that suits your account.
Follow this option if you want to tag at MCC level, don't want to connect your Google Ads account to Infinity, or prefer to manage the scripts yourself. You set it up in Google Ads with scripts and an account-level tracking template. If you would rather Infinity set this up for you, follow Option 2 below instead.
For the best tagging experience, set this up with custom ValueTrack parameters within Google Ads. The steps below use Google Ads scripts to make sure every campaign and ad group has custom ValueTrack parameters with its Campaign and Ad Group names. Infinity's tracking template then uses those names, so your paid search activity is tracked in Infinity.
The steps below follow the latest Google Ads interface, and they complete Google Ads tagging for every campaign and ad group.
This part of the script looks at campaigns. It runs a search query on all enabled campaigns, creates a CSV with the campaign name and the custom parameters, and then uses the bulk updater to apply the changes. The Google Ads script only returns standard campaigns, so to update other campaigns, the script searches for the data it needs and triggers a bulk CSV upload to make the changes.
function updateCampaigns(){
// Query to get all enabled campaigns
const campaigns = AdsApp.search(`
SELECT
campaign.id,
campaign.name,
campaign.url_custom_parameters
FROM campaign
WHERE campaign.status = 'ENABLED'
`);
// Start a new bulk upload with the required headings.
const campaignBulkUpload = AdsApp.bulkUploads().newCsvUpload(['Campaign', 'Campaign ID', 'Custom parameter'])
// Iterate over all available campaigns until we've seen them all.
while (campaigns.hasNext()) {
// Grab the next campaign on the list and any existing Custom Parameters
const { campaign } = campaigns.next();
const paramValue = encodeURIComponent(campaign.name).replaceAll('%2B', '+');
// Container to hold the individual parameters that we'll join together later.
const customParamStringParts = [];
// Get the list of custom parameters if there are any, or default to an empty list.
const customParams = campaign.urlCustomParameters || [];
// Check to see if we have an existing paramter for campaign
const existingParam = customParams.find((param) => param.key === 'campaign');
if (existingParam) {
// If the values are the same, skip to the next one.
if (existingParam.value === paramValue) {
continue;
}
// Otherwise, set the updated value against the existing parameter
existingParam.value = paramValue;
} else {
customParams.push({ key: 'campaign', value: paramValue });
}
for (const param of customParams) {
// Add the parameter to the container
customParamStringParts.push(`{_${param.key}}=${param.value}`);
}
campaignBulkUpload.append({
"Campaign": campaign.name,
"Campaign ID": campaign.id,
// Joins the parameters together, separated by a semi-colon
"Custom parameter": customParamStringParts.join('; ')
});
}
// Trigger the bullk upload. In preview, this will trigger an upload preview.
// Go to Tools and Settings > Bulk Actions > Uploads to see the results.
campaignBulkUpload.apply();
}
Save this section of the script as Campaign Bulk Upload.gs.
Click the blue + icon to open a new script window, then copy and paste the text below. This part of the script relates to ad groups. It cycles through all the active ad groups and makes sure the custom parameters are added where needed. You won't see any changes to your ads when the script runs if it doesn't need to make any. This is a quieter approach than previous tagging methods.
function updateAdGroups(){
const adGroups = AdsApp.adGroups().withCondition("CampaignStatus = ENABLED").get();
// Iterate over all available Ad Groups until we've seen them all.
while (adGroups.hasNext()) {
// Grab the next Ad Group on the list and any existing Custom Parameters
const adGroup = adGroups.next();
const adGroupParams = adGroup.urls().getCustomParameters();
// Encode the name so that it's safe for URLs but keep '+' as it is.
const paramValue = encodeURIComponent(adGroup.getName()).replaceAll('%2B', '+');
if (adGroupParams.adgroup === paramValue) {
continue;
}
// Add the ad group name to custom parameters.
Object.assign(
adGroupParams,
{
adgroup: paramValue
}
);
// You can only have 8 custom parameters, so if there are more than that we cannot continue.
if (Object.keys(adGroupParams).length > 8) {
console.warn(`Ad Group: ${adGroup.getName()} does not have enough free custom parameters.`);
continue;
}
// Set the updated custom parameters against the ad group.
adGroup.urls().setCustomParameters(adGroupParams);
}
}
Save this section of the script as Ad Group.gs.
Click the blue + icon to open a new script window, then copy and paste the text below. This part of the script runs the other two parts.
function main(){
updateCampaigns();
updateAdGroups();
}
Save this section of the script as Code.gs. Your window should now look like this:
Running a preview also triggers a bulk upload, but that upload is still a preview. To see the results, go to Tools > All Bulk Actions. You can apply the campaign changes from the preview in Bulk Actions without running the script again, for example if the preview has campaign changes but no ad group changes.
Click Save, and the script runs on the schedule you chose. You can return to this page to see when the script last ran and what the outcome was.
If you use Infinity's tagging sync for the account, managed from the Google Ads integration in Infinity, disable it before you go to the next step, so the two methods don't conflict.
If you have used Infinity tracking templates at campaign or ad group level before, remove them, so that the tag isn't duplicated. Create a new script in Google Ads, following the same steps as above, and paste in the text below.
function main(){
const adGroups = AdsApp.adGroups().withCondition("CampaignStatus = ENABLED").get();
while (adGroups.hasNext()) {
const adGroup = adGroups.next();
const adGroupTrackingTemplate = adGroup.urls().getTrackingTemplate();
if (adGroupTrackingTemplate && adGroupTrackingTemplate.indexOf('infinity{ifcontent:display}') > -1) {
adGroup
.urls()
.setTrackingTemplate(
adGroupTrackingTemplate.replace(/(?<=&|\?)infinity{ifcontent:display}(=[^&]*)?(&|$)/, '').replace(/{lpurl}\?$/, '{lpurl}')
);
}
}
const campaigns = AdsApp.campaigns().withCondition("CampaignStatus = ENABLED").get();
while (campaigns.hasNext()) {
const campaign = campaigns.next();
const campaignTrackingTemplate = campaign.urls().getTrackingTemplate();
if (campaignTrackingTemplate && campaignTrackingTemplate.indexOf('infinity{ifcontent:display}') > -1) {
campaign
.urls()
.setTrackingTemplate(
campaignTrackingTemplate.replace(/(?<=&|\?)infinity{ifcontent:display}(=[^&]*)?(&|$)/, '').replace(/{lpurl}\?$/, '{lpurl}')
);
}
}
}
This script tries to remove any Infinity templates from ad group and campaign level tracking templates. You only need to run it once.
Now that your custom ValueTrack parameters are set up, add the Infinity tracking template to your account, so that all your paid search activity can be tracked.
infinity{ifcontent:display}=ict2~net~gaw~cmp~{_campaign}~ag~{_adgroup}~ar~{creative}~kw~{ifsearch:{keyword}}{ifcontent:{placement}}~mt~{matchtype}{ifcontent:c}
If you have already set up Google Ads tagging with a previous method, the Infinity template is below. The number at the end is the Customer ID, so replace it with your own:
infinity{ifcontent:display}=ict2~net~gaw~cmp~{campaignid}~ag~{adgroupid}~ar~{creative}~kw~{ifsearch:{keyword}}{ifcontent:{placement}}~mt~{matchtype}{ifcontent:c}~acr~123456789
Google Ads tagging with custom ValueTrack parameters can also be applied at MCC level, but it needs a small change. Follow the steps above and set up the scripts on the MCC account. Instead of the main script in Step 7, use the script below:
function main() {
// Run on each account in parallel
AdsManagerApp.accounts().executeInParallel('updateCampaigns');
AdsManagerApp.accounts().executeInParallel('updateAdGroups');
}
This runs the ValueTrack sync on each account under the MCC.
Watch the video: Google Ads tagging using custom ValueTrack parameters: video walkthrough
Infinity adds the scripts and tracking template to your Google Ads account for you. If you want to tag at MCC level, don't want to connect your account to Infinity, or prefer to manage the scripts yourself, follow Option 1 above instead.
You need either the Administrator or Integration Manager role to access the tagging settings in the Infinity Platform.
Log in to the Infinity Platform and select Settings from the bottom left-hand navigation. Then choose Google Ads from the Integrations section. The page has two tabs. Conversion Tracking is where your integrations with Google Ads are set up. Account Tagging is where tagging is set up. Select Account Tagging to see your Google Ads accounts that are set up for tagging. Each account shows the date it was added and the date its data was last synced, with a green or red label showing whether it is enabled.
When you add a Google Ads account to the Account Tagging list, Infinity adds a script to your Google Ads account, so the custom ValueTrack parameters we need are available on the final URLs. Infinity then adds a tracking template at account level, as a final URL suffix, to capture the details we need.
Select Account Tagging, log in to your Google Ads account, and use the dropdown to select the Google Ads account you want to tag. Google doesn't support tracking templates at MCC level. This means you can only add client-level accounts for tagging, even if you use an MCC account to connect Infinity and send event data to Google Ads.
You can disable or delete an account at any time. Select the account in the Account Tagging list, click the three dots on the right-hand side, then select Disable or Delete.
If you ever need it, the Infinity template that Infinity adds as an account-level final URL suffix is:
infinity{ifcontent:display}=ict2~net~gaw~cmp~{campaignid}~ag~{adgroupid}~ar~{creative}~kw~{ifsearch:{keyword}}{ifcontent:{placement}}~mt~{matchtype}{ifcontent:c}
There are three known errors that can affect a tagging account: Invalid Credentials, Login Customer Invalid and Account Deleted. The error message is shown alongside the error label. Use the more menu (three dots) to resolve them.
This means the credentials used for the account are invalid. Click the three dots to sign in to Google and use your credentials instead.
This means we don't have a valid login customer ID for the account. Click the three dots and choose Fix account. You can then log in to Google, select the account from the dropdown, and re-enable the account.
This means the Google Ads account has been deleted. The only fix is to delete the account from the list of tagged accounts. Click the three dots and select Delete account.
Normally, when a Google Ads tagging account is deleted, Infinity removes the Infinity tracking template from that Google Ads account. In some cases, for example if the credentials used to create the account are no longer valid, Infinity can't remove the template. If you see a warning after deleting an account, remove the Infinity tracking template from your Google Ads account manually.
Infinity first added support for tagging Google Ads accounts in the Infinity Platform in 2022. In July 2025, the Account Tagging approach was updated to use the same scripts as Option 1. Existing customers don't need to do anything, as these changes are made automatically. You may notice campaigns appearing with URL parameters when you edit them in Google Ads, and URLs in the Infinity Platform may be listed by their page name instead of their ID.
For more on the Google Ads integration itself, read our Google Ads integration guide. If you need help with Google Ads tagging, get in touch with your Customer Success Manager or email support@infinity.co.