Check if Google Ads auto-tagging works

30/11/2019

There are a number of benefits to Google Ads auto-tagging, so we recommend you use it instead of manually setting up custom campaign tagging.

In this article:

Understand what auto-tagging is

Auto-tagging is a setting in your Google Ads account. When enabled, it appends a Google Click ID (gclid) to the end of your URL, before any fragments (also called "named anchors" and indicated by the presence of a #). If your URL already contains a parameter (indicated by the presence of a ?), then the gclid will be preceded by a & instead of a ?.

Examples
  • example.com/foo?a=b&gclid=Tester123#xyz
  • example.com/foo?gclid=Tester123#xyz

If your website contains redirects, it's important that you preserve the gclid URL parameter in your redirect. Google Analytics and gtag.js tags expect to observe the gclid parameter as top-level parameter on the page where tags are loaded.

Confirm auto-tagging works for your site

Use the Chrome Developer Tools and follow the instructions here to check if auto-tagging works on your site before setting it up.

If you don't see the gclid parameter appended to your URLs after the page is fully loaded, then it's likely that your website isn't configured to handle query parameters in a way that lets auto-tagging work.

  1. Open a new tab in Chrome. Open the Chrome menu, then click Tools > Developer Tools to open the Chrome Developer Tools. Click the Network tab. This pane shows the network (HTTP) requests for the page being loaded and must be opened before the page is loaded.
  2. Copy your Google Ads final URL.

    Note: If you're using a final URL with a tracking template or custom parameters, follow these instructions to get the Click URL (the URL customers will actually click).

    Paste this URL into the Chrome address bar, but don't load the page yet. In the address bar, append a test Google Ads auto-tagging query parameter, like gclid=TeSter-123. This makes the full URL: http://www.example.com/?gclid=TeSter-123.

    If your final URL already contains a question mark (?) followed by a query parameter, prefix the gclid parameter with a '&' symbol. For example: http://www.example.com/?parameter=1&gclid=TeSter-123.

    If your final URL contains a hash '#' symbol, append the gclid parameter before the hash. For example: http://www.example.com/?parameter=1&gclid=TeSter-123#bookmark.

  3. Load the URL and watch the network requests load.

Refer to the Troubleshooting section below to help find a solution.

Troubleshooting

Use the Chrome Developer Toolsto help you troubleshoot.

URL redirects

  1. Turn on Record in the Chrome Developer Tools (black circle on the bottom bar in the Network tab). Enter the original final URL with the test gclid appended into the address bar. Press Enter to load the URL.
  2. Under the Network tab and Headers pane on the right, click some of the first requests listed--they will generally not be type-specific requests (no image or code file extensions).
  3. Inside the request, look for an HTTP status code of 301 or 302. These codes indicate a redirect.
  4. Under the Response Headers section, look for the Location value, which indicates where the browser has been redirected. (Note that redirects can consist of multiple legs, so you might have to check several page HTTP requests to find out where the gclid is lost).
  5. If the new URL doesn't have the auto-tagging parameter and the value you specified earlier, then it's likely that Analytics has not been able to store the gclid value.

In some cases, you might not see gclid parameter in the final landing page URL but the Analytics code from the previous page might still have sent it in the redirect process (this usually happens too quickly to observe by eye). To check if the gclid was sent by the Analytics code on a previous page, look at the collect request made by the page. Use the filter icon to help sort or search for collect requests.

  1. In Chrome Developer Tools, under the Networks tab, click on the collect request in the left pane.
  2. In the Headers pane on the right, under the Query String Parameters section, look for the dl parameter in the collect request.
  3. You should see gclid=TeSter-123. If you don't see this value, then the gclid parameter was not successfully parsed and stored by Analytics.

To resolve an issue where the Analytics auto-tagging parameter is being removed by a redirect, you can:

  • Try updating your Google Ads destination URL to the final URL. For example, if your Destination URL is www.example.com/redirect-page but this page actually redirects to www.example.com/new-url, then use the latter URL for your ad destination URL.
  • If the redirect is caused by a server-side rule, try reconfiguring your server settings to stop the redirect. Every web server is different, so methods will vary. For example, Apache servers rely on a .htaccess file to configure redirect rules. If you can't stop the redirect, configure your server to allow redirects to carry query parameters (like the gclid) from the initial URL to the final URL. For example, the final URL with auto-tagging is: www.example.com/redirecting-page?gclid=TeSter-123, when the redirect occurs it should forward the user to www.example.com/new-url?gclid=TeSter-123 (note here that the gclid parameter remains the same, although the page URL changes).

Tracking code errors

The Analytics tracking code snippet could be causing an issue if it isn't set up correctly on the page. Using the Chrome Developers Tool, look for the collect request in the Network requests tab. If the collect request isn't loading on the page, the Analytics tracking code snippet isn't set up correctly.

Additionally for Google Ads tracking, the tracking code must be placed on every landing page.

For more information, visit the article on how to check your web tracking code set up.

Content frames

You can use Analytics inside an HTML frame like an