Track calls to a phone number on a website

Use phone call conversion tracking to help you see how effectively your ads lead to phone calls from your website. When someone 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 you set. This way, you can filter out shorter calls that probably don’t include sales or other valuable actions for your business.

Before you start

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 see all call conversion actions in the article on Using phone call conversion tracking.

Website call conversions only work if you have call extensions enabled. The phone number that you set in your call extension is used to track calls from your website. Learn how to Use call extensions

Benefits

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 see which specific keywords, ads, ad groups and campaigns are leading to call conversions.

Here, we'll show you how to track these phone call conversions using a Google forwarding number on your website.

Requirements

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

  • A Google Ads account: Don't have one yet? Sign up at https://ads.google.com.
  • An active call extension: You'll need at least one call extension. You can set this up before or after creating a call conversion action.
  • 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 your website: Either you or your webmaster 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

Example of phone snippet with optional parameters.There are 2 parts to setting up conversion tracking for calls to a Google forwarding number on your website:

Step 1: Create a conversion action

  1. Sign in to your Google Ads account.
  2. In the upper right corner, click the tools icon , and under "Measurement", click "Conversions".
  3. Click the plus button .
  4. Click Phone calls.
  5. Select Calls to a phone number on your website.
  6. Next to 'Conversion name', enter a name for the conversion that you’d like to track, such as 'newsletter sign-up' or 'wedding bouquet purchase'. This will help you to recognise this conversion action later in conversion reports. An example might be 'Flower phone orders' or 'Booking calls'. 
  7. Next to 'Category', select a description for your conversion action from the drop-down menu. The category allows you to segment your conversions in reports, so that you can see similar conversions together.
  8. Next to 'Value', enter a value for each call, or select Don’t use a value if you'd prefer not to count one. 
  9.  Next to 'Count', select how to count these conversions.
    • One. This setting is best for leads, such as a sign-up form on your website, when only one conversion per ad click probably adds value for your business.
    • Every. This setting is best for sales, when every conversion probably adds value for your business.
  10. Click Call length. Enter the minimum length, in seconds, that a phone call needs to last to be counted as a conversion. 
  11. Click Conversion window. Select a conversion window for this conversion action. The window can be as short as one week or as long as 60 days. 
  12. (Advanced) Click Include in "Conversions." Opting into this setting – selected by default – will include data for this conversion action in your "Conversions" reporting column. If you deselect this setting, data will still be included in the “All conversions” column.

    Data in the “Conversions” column is used by automated bid strategies such as Target return on ad spend, Enhanced cost per click or Target CPA. So, if you use an automated bid strategy to optimise for conversions, and you don’t want to include this particular conversion action in your bid strategy, you can untick this setting. Otherwise, leave it ticked. Learn more about the 'Include in 'Conversions'' setting
  13. Click Create and continue

You’ll now see a screen with next steps to finish setting up conversion tracking.

Step 2: Set up your conversion tracking tag

To set up conversion tracking for the first time, you'll need to add 2 code snippets to your website: the global site tag and a phone snippet.

The global site tag adds website visitors to your 'All visitors' remarketing lists (if you've set up remarketing) and sets new cookies on your domain, which will store information about the ad click that brought someone to your site. Note that your Google Ads conversion tracking tag will be able to use this click information to attribute a conversion to your Google Ads campaigns. Please ensure that you're providing users with clear and comprehensive information about data collection, and obtaining consent where legally required.

You must install the global site tag on every page of your website, but you need only one global site tag for each Google Ads account.

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. Under 'Global site tag', select the option that best describes your situation and follow the instructions for installing the tag:​
    • I haven’t installed the global site tag on my website: Choose this option if it’s your first time setting up the tag for a conversion action in your account and you haven’t installed the global site tag from another Google product. This option shows the full global site tag. To install the tag, copy the tag code and paste it between the <head></head> tags of every page of your website.

      Here’s an example of a global site tag, where “CONVERSION_ID” stands for the conversion ID that’s unique to your Google Ads account:

      <script async src='https://www.googletagmanager.com/gtag/js?id=AW-CONVERSION_ID'></script>
      <script>

        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', 'AW-CONVERSION_ID');

      </script>

       
    • I installed the global site tag on my website from another Google product (example: Google Analytics) or from another Google Ads account: If this option applies to you, you won’t need to add the global site tag to your website again; however, for conversion tracking to work for this account, you’ll need to add the config command (the piece of code that contains your conversion ID) to every instance of the global site tag. This option shows that command, where “AW-CONVERSION_ID” stands for your account’s conversion ID:

      gtag('config', 'AW-CONVERSION_ID');

      Add the config command to every instance of the global site tag on your website, right above the </script> end tag. 

      Here’s an example of a global site tag that’s configured for both Google Analytics and Google Ads, with the config command for the Google Ads account highlighted:

      <script async src='https://www.googletagmanager.com/gtag/js?id=GA-_TRACKING_ID'>
      </script>
      <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());

        gtag('config', 'GA_TRACKING_ID');
        gtag('config', 'AW-CONVERSION_ID');
      </script>

    • I already installed the global site tag on my website when I created another conversion action in this Google Ads account: If this option applies to you, you don’t need to add the global site tag again to your website. Just make sure that the global site tag appears on every page of your site and that the config command in each instance of the tag contains your account’s conversion ID. You’ll see your conversion ID when you select this option.
  2. (Optional) Modify the global site tag based on your preferences:  

    • If you don’t want the global site tag to add website visitors to your remarketing lists, add the highlighted portion below to your global site tag’s config command:

      gtag('config', 'AW-CONVERSION_ID', {'send_page_view': false});

    • If you don’t want the global site tag to set first-party cookies on your site’s domain, add the highlighted portion below to your global site tag’s config command:

      gtag('config', 'AW-CONVERSION_ID', {'conversion_linker': false});

      We don’t recommend doing this as it will lead to less accurate conversion measurement.

  3. Copy the global site tag, then follow the instructions to add it to your website.

  4. Next to “Phone snippet”, select one of the following options:

    • Enter your phone number as it appears on your website. Enter the phone number that you want to track calls to. Make sure that you enter the exact digits that appear on your website. For example, if the number on your website has a country code, include the country code here. If the number on your website doesn't have a country code, don't include the country code here. Then, click Create snippet. (Note that this option doesn’t work if you want to track multiple phone numbers on your website.)

      Example: You list the number on your website as 1-650-555-5555. You should enter the number as 1-650-555-5555. If you enter 650-555-5555, or 555-5555, Google Ads won’t be able to properly find your number and track your conversions.

    • Don’t enter a number. You’ll need to edit your website code manually. 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.

  5. Under “Install the phone snippet”, you’ll now see the code for the phone snippet based on the option you selected. Copy the snippet to add it to your website now, or click Download snippet to add it later. 

  6. Open up the HTML for the page where the phone number appears on your website.

  7. Between the head tags (<head></head>) of the page, paste the phone snippet, right after the global site tag.

  8. Save the changes to your web page.

  9. Click Next.

  10. Click Done

Example

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>
<header>
<title>Sample HTML File</title>
</header>
<body>

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


Sample HTML after conversion tracking code (sample only – don't use in your website's code).

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


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

</script>

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

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

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

You can use Google Tag Manager (GTM) to track calls to a phone number on your website by implementing the global site tag and event snippet in GTM custom HTML tag.
 
To implement the global site tag and the event snippet in the same GTM custom HTML tag:

  1. Create a custom HTML tag, then place the global site tag and event snippet gTag in that tag.
  2. Set the trigger to fire, for example, All Pages (Page View).

Once done, the Google Tag Assistant will show the tag fired on the event and Website Call Metrics. You may go to the preview and debug mode of GTM to preview your site.

Note

If the global site tag and the event snippet tag are in separate GTM custom HTML tags, you need to enable Tag Sequencing to fire event snippet tag after the global snippet has fired. Global site tag custom HTML must fire before the event snippet for website call conversions. 

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 webmaster now need to do the following:

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

    <script>
      gtag('config', 'AW-CONVERSION_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 including 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 2 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 (Example: '18001234567').
    2. phone_conversion_css_class: Enter a CSS class name. All elements of that class will have their content replaced with a formatted telephone number.
    3. phone_conversion_options: You can enter one of the following values:
      • timeout: Maximum time in milliseconds that's allowed for retrieving a number. If a number cannot be fetched within this time, then 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', 'AW-CONVERSION_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 web page. 

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

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

This function gets a telephone number and replaces the content 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', 'AW-CONVERSION_ID/CONVERSION_LABEL', {
          'phone_conversion_number': '1-800-123-4567',
          'phone_conversion_css_class':'number'
        });
      </script>

  2. In the HTML for the web page 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

Gets a telephone number and sends it to a callback function. The example callback function will replace the content of an element with 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, 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, '+08001234567')
          var e = document.getElementById('number');
          e.innerHTML = "";
          e.appendChild(document.createTextNode(formatted_number));
        };

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

  2. In the HTML for the web page 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, '+08001234567')
          var e = document.getElementById('number');
          e.href = 'tel:' + mobile_number;
          e.innerHTML = "";
          e.appendChild(document.createTextNode(formatted_number));
        };
        gtag('config', 'AW-CONVERSION_ID/CONVERSION_LABEL', {
          'phone_conversion_number': '1-800-123-4567',
          'phone_conversion_callback': callback
        });
      </script>

     
  2. In the HTML for the web page 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. If you'd like to make sure that 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 regular 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 on an ad again.

 

 

Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue