To track conversions such as purchases, leads, and sign-ups,
Google Ads utilizes global site tags that rely on JavaScript (gtag.js) to collect conversion data.
While conversion tracking is useful for evaluating advertising performance,
it is not a requirement for the CPC pricing model. However, if using the CPA (cost per acquisition)
pricing model to track acquisitions, conversion tracking snippets must be inserted into all of the
pages of the website.
Conversion tracking relies on two gtag commands – a ‘config’ command that configures the
Google Ads account and an ‘event’ command that sends event data to Google Ads.
The steps required to set-up the conversion tracking facility for Google Ads
campaigns, are as follows:
- Create a conversion action at Tools & setting > Measurement > Conversion in the Google Ads
account. This generates a conversion tracking code snippet to track users that complete the conversion action
after clicking an ad.
- Add the global site tag snippet such as the one shown below, which contains the config command,
to all pages of the website.
Note: If the global site tag has already been installed, only the config command on the last line
of the code, needs to be added.
<!-- Global site tag (gtag.js) - Google Ads: accountID -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-accountID "></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-accountID ');
</script>
- Add the event command to the webpage (e.g., “Thank you for your order” page) that the customer is sent to after the conversion action is completed.
<!-- Event snippet for Purchase conversion page -->
<script>
gtag('event', 'conversion', {
'send_to': 'AW-accountID/eventID',
'transaction_id': ''
});
</script>