How to get the specific <Ad ID, Campaign ID> that was clicked on from the landing page?

manuelflara picture manuelflara · Jun 20, 2014 · Viewed 11.9k times · Source

I've been searching for a solution to this, which I thought would be trivial, and seems pretty much impossible.

Here's the situation: I set up an AdWords campaign, ad groups and ads. I point them to www.mysite.com

Once visitors arrive to my site through one of my ads, I want to know which exact ad they clicked on (and campaign, as apparently the ad id isn't globally unqiue). Is this possible?

I first tried by enabling Destination URL auto-tagging, but seems like the gclid parameter is pretty much useless.

Then I looked at the UTMZ cookie, but it seems like at most (correct me if this isn't the case), you get the campaign number (is this even the ID in AdWords?) and the keywords searched or the ad's keywords, one of those. Not anything I can uniquely identify the ad by, right?

Finally, I looked at ValueTrack, although again correct me if I'm wrong, but this would mean manually changing the destination URL of each of my ads in AdWords, right? Even doing this, I'm not sure I can get something that lets me uniquely identify the clicked ad. Is {creative} what I want? It's described in the docs as the "unique ID of the creative", does that mean this includes the Campaign.Id and the AdGroupAd.Id?

Thanks!

Answer

Flimm picture Flimm · Jun 1, 2016

There is a way to do what you want using tracking templates.

Navigating to auto-tracking and tracking template settings:

  1. Log in to Adwords, and click "Campaigns".
  2. Click "Shared Library" in the bottom left corner.
  3. Under "Shared Library", click "URL options".
  4. You'll now get these options: URL Options screenshot, with options "Tracking template" and "Auto-tagging"

These options are set for the entire account. I think it is possible to override the tracking template for individual campaigns, ad groups and ads. Here is what they mean:

Auto-tagging

Auto-tagging means that when a user clicks on an ad, they will go a URL with the gclid parameter appended, for example http://yourwebsite.com/?gclid=example. This value is useful for some things, such as for offline conversions, so your website should save it.

Tracking template

Tracking template means that when a user clicks on an ad, they will be directed to this URL. Interestingly, it does not have to be your website, as long as the URL redirects to your website. For instance, you could set it up to look like this:

http://trackingcompany.com/?url={lpurl}&campaignid={campaignid}

{lpurl} and {campaignid} are placeholders which AdWords recognises and knows how to handle. So, for example, if a user clicks on an ad, they could go to:

http://trackingcompany.com/?url=http%3A%2F%2Fyourwebsite.com&campaignid=543987

trackingcompany.com must redirect the user now to http://yourwebsite.com, otherwise, it is in violation of AdWords policy and your ads could be rejected.

Now, here's the clever bit that I didn't realise because all of this is badly documented: you don't have to use a third-party tracking company to get access to things like campaign id. You can just reuse your own website! Just set your tracking URL to something like this:

{lpurl}?campaignid={campaignid}

You see that? {lpurl} will get replaced with the landing page, which is your website! So the user in our example would go to this URL upon clicking an ad:

http://yourwebsite.com?campaignid=543987

It's not clear to me whether example.com must now redirect to the landing page URL without those parameters, or not.

I can't find documentation on these placeholders anywhere, but these are the ones that I've found work:

  • {lpurl} landing page URL
  • {campaignid} campaign ID
  • {adgroupid} ad group ID
  • {creative} creative or ad ID
  • {keyword} keyword

Auto-tagging and tracking template together

If you enable both auto-tagging and a tracking template, then AdWords would behave as it normally does with a tracking template, appending a gclid query parameter.


Addendum: ignoring these new query parameters in Google Analytics:

If you use Google Analytics, you probably want to ignore these query parameters, merging hits with these parameters with hits that don't have them. You can do that by setting the "Exclude URL Query Parameters" option to aw_campaignid,aw_adgroupid,aw_creative,aw_keyword. You can't apply this retroactively, so do this before making any AdWords changes.

Screenshot of Exclude URL Query Parameters option