If you use the Google tag as your tag, you can implement Phone Analytics to measure how users interact with phone numbers on your website.
Once implemented, the code generates one of a range of Google numbers that forward calls to your business.
You can implement Phone Analytics and Ads call conversion tracking on the same page.
Implement call tracking for Analytics
Add the following snippet to your existing gtag.js code on each page your phone number appears on.
gtag('set', {
'phone_conversion_number': 'NUMBER_TO_REPLACE',
'phone_conversion_country_code': 'COUNTRY_CODE_TO_REPLACE',
'phone_conversion_ids': ['GA_TRACKING_ID']
});
For example:
gtag('set', {
'phone_conversion_number': '1234567890',
'phone_conversion_country_code': 'US',
'phone_conversion_ids': ['AW-999999999/abc123', 'UA-12345-6']
});
Implement call tracking for Analytics and Ads
Add the following snippet to your existing gtag.js code on each page your phone number appears on.
gtag('set', {
'phone_conversion_number': 'NUMBER_TO_REPLACE',
'phone_conversion_country_code': 'COUNTRY_CODE_TO_REPLACE',
'phone_conversion_ids': ['AW-CONVERSION_ID/CONVERSION_LABEL', 'GA_TRACKING_ID']
});
For example:
gtag('set', {
'phone_conversion_number': '1-800-123-4567',
'phone_conversion_country_code': 'US',
'phone_conversion_ids': ['AW-123456789/aBcDeFgHiJkL', 'UA-012345678-1']
});
Parameters
The following phone parameters are supported in the set
command:
Name | Required | Description |
---|---|---|
phone_conversion_number |
Yes | The phone number to replace. This number should match the number configured in your Analytics or Ads UI. |
phone_conversion_country_code |
Yes | The ISO 3166-1 alpha-2 country code of the phone number to replace. |
phone_conversion_ids |
Yes | A list of Analytics tracking IDs and Ads conversion IDs or conversion labels to measure. |
phone_conversion_class |
No | The DOM ID or CSS class of an element. The provided element's text will overwrite the replacement number. |
phone_conversion_callback |
No | A function to handle inserting the replacement number into the page. |
phone_conversion_options |
No | A map of additional advanced options for phone conversions. |
Script loading
gtag.js defines a default script path to load the phone conversion script from. You can use a variable to override this path for beta rollouts of new versions of the script.
Initially, gtag.js loads the script from:
http://www.gstatic.com/call-tracking/call-tracking_1.js
Use the var_phone_conversion_impl
runtime flag to override the script version
number to use new (beta) versions of the implementation script, without
waiting for runtime releases.
For example:
{
key = 'var_phone_conversion_beta_version'
value = {
enabled = true
// Impl script version to override (path is not configurable)
value = '2'
}
}
This configuration replaces the hardcoded default script path with:
`www.gstatic.com/call-tracking/call-tracking_2.js`
Support for existing implementations
To support beta Phone Analytics implementations and existing Ads call conversion
tracking implementations, if an Analytics (GA_TRACKING_ID) or Ads
(AW-CONVERSION_ID/CONVERSION_LABEL) config
command is processed and the key
phone_conversion_number
is set in the model, but the phone_conversion_ids
are not set, gtag.js will configure phone conversions for the IDs associated
with the command.
Prerequisites
To implement phone analytics you need to:
- Use a US phone number.
- Link your Analytics and Ads accounts.