In order for Optily to correctly tell your various campaigns apart, you have to use UTM tags in a particular way for everything to work properly.

**For those of you who are already familiar with UTMs, feel free to skip the overview section and go straight to the "Optily-specific UTM Guide."**

Overview of UTMs

UTM tags are added to the end of your URLs so you know where each link was placed from Analytics. For example, you can see if more people are coming through from your latest email blast or through your Instagram page.

By using UTM tags in your links, you can capture campaign data that refer traffic to your site. Optily can then register the performance of those campaigns, allowing you to attribute specific goals or eCommerce values to campaigns, platforms, and even specific keywords and ads. In order to do this effectively, it is important to understand the different parameters that can be used and how to fill them accurately.

Here's a breakdown of the 5 parameters that Google Analytics recognizes:

  • Campaign Source: (Required) The platform or vendor where the traffic originates, like Facebook, Google, or your email newsletter. In marketing terms, this is "where" your visitor saw your message.

  • Campaign Medium: (Required) The advertising or marketing medium, like paid, cpc, social, email, affiliate, or referral. In marketing terms, this is "how" your message was delivered to your visitor.

  • Campaign Name: (Required) The individual campaign name, slogan, promo code, or specific product promotion. To see the current campaign names being tracked on Google Analytics, navigate to Acquisition → Campaigns → All Campaigns.

  • Campaign Term: (Optional) To track keywords or identify aspects of your audience used in paid search or display campaigns.

  • Campaign Content: (Optional) A useful metric to indicate the specific ad in a campaign. It can also be used for A/B testing ads that pass the same details and used to differentiate links that point to the same URL from the same source.

Example URL with parameters:

UTM Parameter

Acceptable Value



google, facebook, twitter, linkedin



cpc, cpm, paid, organic, social, email, referral, affiliate



enter the name you have given to your campaign in facebook or google to better match reports



keyword, keyword+or+phrase,



banner, video, left, carousel, imagelink, logolink, signaturelink


Some good rules to follow are:

  • Google Analytics reads Facebook and facebook differently. Since Google Analytics defaults its own data to lower case, make sure to follow consistent nomenclature and use lowercase as well.

  • Stay consistent with your naming to ensure reporting consistency. If you use facebook as a source in one campaign, don't use Facebook, FaceBook, FB, fb, fbook, or any other variant in other campaigns.

  • Using + symbol instead of spaces allows Google Analytics to display the term better. If you put spaces in, then "video 2" would be shown as "video%202" and "spring promotion 2021" would show as "spring%20promotion%202021" so use "video+2" and "spring+promotion+2021" instead.

  • Make sure to match the Facebook campaign name is an exact match in the utm_campaign including any capital letters. This ensures accurate tracking on Google Analytics.

Optily-specific UTM Guide

In order for the Optily algorithm to work properly, you need to follow this specific naming convention when creating your UTMs for Google and Facebook Ads. The video explains everything in detail, while the details and scripts are below for you to copy:

Suggested naming convention for campaigns:

channel-campaignName-objective or channel-campaignID-campaignName-objective

gg-15287204853-bridal23-shopping yt-234333-bridal33-video

  • Don’t use spaces

  • Don’t use uppercase

  • Don’t use any characters other than alphanumeric characters, hyphens, or underscores


Copy the following into the UTM parameters field at the ad level:


Once a campaign has been published, do not change the campaign name. IF the campaign name has been changed since the campaign was first published, replace {{}} with the actual name of the campaign e.g. fb-bridal0001-traffic


1. Ensure all campaign names have no spaces

2. Update the tracking template at the account level

Copy this into the Account Settings > Tracking > Tracking Template


3. Add and run script

  1. At the account level, in the top nav under Tools and Settings click on Scripts

  2. Click the + icon to add a new script

  3. Replace everything in the main script box with the entire script below

  4. Take these Steps - AUTHORIZE then PREVIEW then SAVE then RUN

  5. Give the script a name

  6. Schedule it to run every hour

  7. An error will occur if there are still campaigns with spaces in the name. Fix this and run again.

// This script will set custom parameter {_campaign} at the adgroup level which can be used in the Account level tracking template.

function main(){

let adGroups = AdsApp.adGroups().withCondition("CampaignStatus = ENABLED").get();

while (adGroups.hasNext()) {

let adGroup =;

let campaign=adGroup.getCampaign().getName();

adGroup.urls().setCustomParameters({campaign: campaign});



Find the Google UTM builder here:

Or use our own Excel spreadsheet:

(You'll need to enable Macros)

Did this answer your question?