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.
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 the article 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 two parts to setting up conversion tracking for calls to a Google forwarding number on your website.
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.
- 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.
- 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 one number can be tracked on a single page using the default Javascript tag.
- Email the tag.
- Use Google Tag Manager.
- If you chose Email the tag, next to 'Email address', enter your web developer’s email address.
- Click Send and continue.
- Click Create and continue.
- 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 (sample only – don't use 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 web page.
</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
- Login to Google Tag Manager.
- Select any of the workspaces.
- Click Tags.
- Click New to create a new tag.
- Click Tag configuration. Scroll down and select Google Ads calls from website conversion.
- Provide the phone number as it is displayed on your website.
Note: The phone number that you enter needs to have the exact digits it has on your website.
- Provide the conversion ID and label from the Google Ads account.
- Provide or create a trigger which 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 web page, the forwarding number provided in step 6 is activated without any additional user triggers.
- 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 with 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 next steps.
Examples
- 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> - 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.
- (Optional) Add the following optional parameters to your phone snippet. Follow these guidelines to enter values for the following parameters:
- 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').
- phone_conversion_css_class: Enter a CSS class name. All elements of that class will have their content replaced with a formatted telephone number.
- 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', '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> - 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.
- 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> - 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
This function gets a telephone number and sends it to a callback function. The example callback function will replace contents of an element with the ID 'number' with the formatted forwarding number.
- 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 ‘
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> - 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.
- 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> - 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. 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.