Advertising and attribution

Check if Google Ads auto-tagging works

See if you can use Google Ads auto-tagging on your site, and troubleshoot your setup.

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 More 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 Tools to 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 <iframe>. Because child frames can't read their parent frame address URL, the Analytics tracking code embedded in an iframe can't see the auto-tagging (gclid) value even if it's visible in the browser address bar of the page you're looking at.

To resolve this issue, make sure Analytics is installed on the parent page. For more information, visit the Developer Guide on how to set up cross domain tracking across iFrames.

URL case conversion

If the auto-tagging gclid value case is being altered by a URL rewrite engine on your server (like if gclid=TeSter is being changed to all lower cases gclid=tester), Analytics can't determine which the Google Ads click is associated with the session. If any gclid parameter exists, the data is identified as as coming from source=google and medium=cpc, but all other click-specific data such (like campaign, adgroup, keyword, etc.) appears as (not set) in Analytics reports.

To resolve this issue, configure your web server to allow all non-reserved URL characters, including uppercase characters and symbols like '-' (hyphen) and '_' (underscore), since these may be used by Google Ads to generate a unique gclid parameter for a click.

Length of gclid parameter

The gclid value can be up to 100 characters long. Make sure your log, storage, and redirecting systems can handle gclid parameters of this size. To confirm your website will not truncate long gclid parameters, repeat the troubleshooting steps above using this value: gclid=TeSter-123-ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz-0123456789-AaBbCcDdEeFfGgHhIiJjKkLl.

If the examples in this article don't offer you a solution, consider using custom campaign tracking instead of Google Ads auto-tagging.

If you're experiencing discrepancies between clicks and sessions, you can use the clicks vs. sessions troubleshooter to identify and resolve problems.

Parallel tracking

Learn more About parallel tracking.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
6841366511113048283
true
Search Help Center
true
true
true
true
true
69256
false
false