Track calls to a phone number on a website

Use phone call conversion tracking to help you understand how effectively your ads lead to phone calls from your website. When a user visits your website after clicking one of your ads, website call conversion tracking can help you identify and measure calls from your site.

This kind of conversion tracking tracks a call as a conversion when it lasts longer than a minimum length that you set. This way, you can filter out shorter calls that probably don’t include sales or other valuable actions for your business.

You can use dynamically generated Google forwarding numbers that replace your business number on your site, without any cost to you. As a result, you can assess which specific keywords, ads, ad groups and campaigns are leading to call conversions.

Tip: Phone Analytics and reporting is now available on Google Analytics. If you have a Google Analytics account, enabling website call conversions will allow you to access reporting about calls made to your website. Phone Analytics metrics are available as one of the metric-group options in Google Ads reports.

Before you begin

If you use another system to track when calls lead to sales or other conversions, you might want to create an import calls conversion action instead. Or, you can review all call conversion actions in 'About phone call conversion tracking'.

Here's what you'll need before you can set up conversion tracking for calls from a website:

  • A Google Ads account
  • A business in an eligible country: Google forwarding numbers are currently available in these countries.
  • A website: This is where you'll put the conversion tracking code (called a 'tag').
  • Ability to edit website: Either you or your web developer will need to be able to add the conversion tracking tag to your website, and add a JavaScript snippet to replace your business number with a Google forwarding number.

Instructions

There are 2 parts to setting up conversion tracking for calls to a Google forwarding number on your website.

  1. Create a conversions action
  2. Set up your Google tag

After you've set up your Google tag, you’ll need to add a phone snippet. The phone snippet replaces a phone number on your website with a Google forwarding number. Install this snippet on site pages where your phone number appears.

  1. Next to 'Phone snippet', click Download snippet. You can enter the phone snippet manually on your website. The phone snippet replaces a number on your website with a Google forwarding number so you can see how effectively your ads lead to phone calls from your website. The snippet will be automatically populated with the display number you entered.
  2. Select how you want to install your tag. You can:
    • Install the tag yourself. If you select this option, you’ll need to follow the instructions below to edit your website code manually after you install your tag. This option is more advanced and is recommended only if you’re comfortable using JavaScript. You should use this option if you want to track calls to multiple phone numbers on your website. Note: Only 1 number can be tracked on a single page using the default JavaScript tag.
    • Email the tag.
    • Use Google Tag Manager.
  3. If you chose Email the tag, next to 'Email address', enter your web developer’s email address.
  4. Click Send and continue.
  5. Click Create and continue.
Here are examples of HTML before and after adding the conversion tracking tag:
  • Sample HTML before conversion tracking code (sample only – don't use in your website's code).

    <html>
    <head>
    <title>Sample HTML File</title>
    </head>
    <body>

    This is the body of your web page.
    </body>
    </html>

  • Sample HTML after conversion tracking code (this is a sample only; don't use it in your website's code).

    <html>
    <head>
    <title>Sample HTML File</title>

    <!-- Google tag (gtag.js) - Google Ads: TAG_ID -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'TAG_ID');

    </script>

    <script>
    gtag('config', 'TAG_ID/CONVERSION_LABEL', {
    'phone_conversion_number': '1-650-555-5555'
    });
    </script>

    </head>
    <body>

    This is the body of your webpage.
    </body>
    </html>

Track calls to the phone number on a website using Google Tag Manager

You can use Google Tag Manager to track calls to a phone number on your website by following these guidelines:

Set up your tag in Google Tag Manager

  1. Log in to Google Tag Manager.
  2. Select any of the workspaces.
  3. Click Tags.
  4. Click New to create a new tag.
  5. Click Tag Configuration. Scroll down and select Google Ads Calls from Website Conversion.
  6. Provide the phone number as it is displayed on your website.
    Note: The phone number that you enter needs to match the exact digits it has on your website.
  7. Provide the 'Conversion ID' and 'Label' from the Google Ads account.
  8. Provide or create a trigger that will fire when a user clicks on your search ad and then calls the forwarding number displayed on your website.
    • Note: After the user clicks your ad and visits your webpage, the forwarding number provided in Step 6 is activated without any additional user triggers.
  9. Save the tag and publish the changes.

Note: The Google Tag Manager standard website call conversion tag is not compatible with international number formats. This can lead to Google forwarding numbers displaying 'plus' signs (+) that are not intended to be there. To prevent incorrect plus signs from showing in the Google Tag Manager website call conversion tag, use the national format of the number, without the plus sign.

Edit website code manually to display a Google forwarding number

If you provided the phone number on your website while completing the steps above, you don’t need to follow the steps below. If you selected 'Don’t enter a number', you or your web developer should refer to the examples below for the next steps.

Examples

  1. Open the HTML for the page where you added the phone snippet, or the page where your phone number appears. The phone snippet will look like the code sample below, where TAG_ID stands for your tag ID and CONVERSION_LABEL stands for your conversion label:

    <script>
    gtag('config', 'TAG_ID/CONVERSION_LABEL', {
    'phone_conversion_number': 'REPLACE WITH VALUE'
    });
    </script>

  2. For the phone_conversion_number parameter, replace 'REPLACE WITH VALUE' with your business phone number. Make sure that the number matches the number on your page exactly and includes any relevant country codes.
  3. Optional. Add the following optional parameters to your phone snippet. Follow these guidelines to enter values for the following parameters:
    1. phone_conversion_callback: Enter a callback function. This function will be invoked with two arguments. The first argument is the formatted telephone number (in the same format as the 'phone_conversion_number' parameter) The second argument is the telephone number in a plain format (e.g. '18001234567').
    2. phone_conversion_css_class: Enter a CSS class name. All elements of that class will have their contents replaced with a formatted telephone number.
    3. phone_conversion_options: You can enter one of the following values:
      • timeout: Maximum time in milliseconds that is allowed for retrieving a number. If a number cannot be retrieved within this time, no number is sent to the target. The default timeout is 5000 milliseconds.
      • cache: Set to false to disable caching of the retrieved number in a cookie; otherwise, set the value to true.

    Example of phone snippet with optional parameters

    <script>
    gtag('config', 'TAG_ID/CONVERSION_LABEL', {
    'phone_conversion_number': '1-650-555-5555',
    'phone_conversion_callback': function(formatted_number, mobile_number) {
    // formatted_number: number to display, in the same format as the
    // number passed to 'phone_conversion_number'.
    // (in this case, '1-650-555-5555')
    // mobile_number: number formatted for use in a clickable link
    // with tel:-URI (in this case, '+16505555555')
    var e = document.getElementById("number");
    e.innerHTML = "";
    e.appendChild(document.createTextNode(formatted_number));
    },
    'phone_conversion_options': {
    'timeout': 20,
    'cache': false
    }
    });
    </script>
  4. Save the changes to your webpage.

The examples below show how to implement this code snippet in three different cases.

Example 1: Replace your static phone number with a Google forwarding number

This function gets a telephone number and replaces the contents of all spans of the given class. In this example, the phone number '1-800-123-4567' inside the span tag will be replaced with the dynamically generated, formatted forwarding number.

  1. Add the 'phone_conversion_css_class' parameter with the value number to your phone snippet. This line is highlighted in the example below:

    <script type="text/javascript">
    gtag('config', 'TAG_ID/CONVERSION_LABEL', {
    'phone_conversion_number': '1-800-123-4567',
    'phone_conversion_css_class':'number'
    });
    </script>

  2. In the HTML for the webpage that has your phone number(s), add the class from the 'phone_conversion_css_class' parameter (highlighted in the example below) to the span tag that contains your phone number.
    <body>
    <span class="number">1-800-123-4567</span>
    </body>

Example 2: Pass the Google forwarding number to a custom callback function

This function gets a telephone number and sends it to a callback function. The example callback function will replace contents of an element containing the ID 'number' with the formatted forwarding number.

  1. Update your phone snippet to match the code sample below. Replace '1-800-123-4567' with the phone number that appears on your website. Also, be sure to replace TAG_ID with the tag ID unique to your Google Ads account and replace CONVERSION_LABEL with the conversion label unique to the conversion action.

    <script type="text/javascript">
    var callback = function(formatted_number, mobile_number) {
    // formatted_number: number to display, in the same format as
    // 'phone_conversion_number'.
    // (in this case, '1-800-123-4567')
    // mobile_number: number formatted for use in a clickable link
    // with tel:-URI (in this case, '+18001234567')
    var e = document.getElementById("number");
    e.innerHTML = "";
    e.appendChild(document.createTextNode(formatted_number));
    };

    gtag('config', 'TAG_ID/CONVERSION_LABEL', {
    'phone_conversion_number': '1-800-123-4567',
    'phone_conversion_callback': callback
    });
    </script>

  2. In the HTML for the webpage that has your phone number(s), add the ID parameter with the value number (highlighted in the example below) to the span tag that contains your phone number.
    <body>
    <span id="number">1-800-123-4567</span>
    </body>

To allow people viewing your website on a mobile phone to call your business easily, you can make the Google forwarding number clickable.

Example 3: Pass the Google forwarding number to a custom callback function on your mobile site
On mobile web pages with a clickable phone number, replace both the number that is displayed and the number that is called when clicked. This requires use of the callback function.

  1. Update your phone snippet to match the code sample below. Replace '1-800-123-4567' with the phone number that appears on your website. Also, make sure that you replace 'CONVERSION_ID' with the conversion ID unique to your Google Ads account, and replace 'CONVERSION_LABEL' with the conversion label unique to the conversion action.
    <script type="text/javascript">
    var callback = function(formatted_number, mobile_number) {
    // formatted_number: number to display,in the same format as
    // 'phone_conversion_number'.
    // (in this case, '1-800-123-4567')
    // mobile_number: number formatted for use in a clickable link
    // with tel:-URI (in this case, '+18001234567')
    var e = document.getElementById("number");
    e.href = "tel:" + mobile_number;
    e.innerHTML = "";
    e.appendChild(document.createTextNode(formatted_number));
    };
    gtag('config', 'TAG_ID/CONVERSION_LABEL', {
    'phone_conversion_number': '1-800-123-4567',
    'phone_conversion_callback': callback
    });
    </script>
  2. In the HTML for the webpage that has your phone number(s), add the ID attribute with the value number (highlighted in the example below) to the <a> tag that contains your phone number.
    <body>
    <a href="tel:18001234567" id="number">1-800-123-4567</a>
    </body>

Checking your code

It can take up to an hour for your ads to be enabled for this conversion action. To make sure it's working, you can do a search that brings up your ad, then click the ad to visit your website (you'll be charged for the click). Your usual phone number should now be replaced with a Google forwarding number.

If you're doing repeated tests, delete the 'gwcc' cookie from your browser before clicking an ad again.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
10744292493699924139
true
Search Help Centre
true
true
true
true
true
73067
false
false
false