Most of the Magento stores online utilize Google Ads to market their products online and increase conversions. Google Ads is a very powerful marketing tool which lets you build and display customer oriented Ads which increases the chances of a purchase on your store. It drives traffic and increases your brand awareness as well. Enhanced conversions is one of the powerful tools under Google Ads arsenal which helps you improve the conversion tracking on your Magento store. Furthermore, it increases the accuracy of conversion measurement using PII information (customers personal information such as name, email, etc.). Today we will integrate Magento 2 Google Ads Enhanced Conversion with GTM using Magento 2 Google Tag Manager extension.
Integrate Magento 2 Google Ads Enhanced Conversion with GTM
We need to perform the Following steps in order to ensure the optimum setup:-
- Enable Enhanced Conversion in Google Ads
- Identify the page URL where conversion event occurs
- Ensure the PII data is collected on the conversion page either through data layer or through code using Javascript.
- Setup the Google Ads enhanced conversion tag in GTM
Enable Enhanced Conversion in Google Ads
Please follow the steps below to enable Enhanced Conversions in Google Ads:-
- Go to your Google Ads account and from the left menu select Goals.
- From the left menu click on summary under Conversions
- Click on the conversion action that you want to use to set up enhanced conversion. Scroll down and under the Enhanced Conversion section, click on the checkbox against ‘Turn on Enhanced Conversion’.
- Under the ‘Implementation method’ select ‘Google Tag or Google Tag Manager’
- Enter your Website’s URL and click on ‘Check URL’
- Finally click save button to save your settings and move on to set up the tag in Google Tag Manager.
Identify the page URL where Conversion event occurs
There are different methods to set up the Google Ads enhanced conversion with GTM depending upon how conversions occur on your store. You must identify where the conversion event is happening as well as where the PII data is entered by the user. Generally on Magento stores purchase events occur on the order success page and the PII data is entered on the checkout. We must set up our event tag to fire on the order success page.
PII Data
The first party personal information of the customer is entered in the checkout steps and is a step before the order success page or the purchase event. Our extension Magento 2 Google Tag Manager collects the PII data using a Global Javascript object which is populated on the success page. We will use the user-provided data event tag in the tag manager to map and use this PII data with our Enhanced Conversion tag. Alternatively you can implement the code to collect the PII data from your store by yourself and use this guide to set up the tag.
Setup the Google Ads enhanced conversion tag in GTM
Follow the steps below to create Google Ads Enhanced Conversion tag:-
- Go to your GTM container and from the left menu select Tags and click on New to create a new tag. Enter the name of the tag as ‘Google Ads Conversion tracking’ and click on ‘Tag Configuration’
- In the ‘Tag Type’ section select “Google Ads Conversion Tracking’.
- Enter the ‘Conversion ID’ and ‘Conversion Label’ found in your Google Ads account.
- Under the conversion Value, Transaction ID, and Currency code, select the appropriate variables that store this information from the data layer.
- Before moving on to the next step we will create a variable that collects PII data from our Global Javascript object. To do this, create a new variable named ‘USER-DATA’ in GTM and select the variable type as ‘Custom Javascript’.
- In the custom Javascript section, paste the code shown below. It collects the PII information from the javascript object. Also, test the variable to make sure that the data is getting collected by using GTM’s preview mode.
function () { return { "sha256_email_address": conversionData.emailhash, "sha256_phone_number": conversionData.phone_numberhash , "address": { "address.sha256_first_name": conversionData.address.first_namehash, "address.sha256_last_name": conversionData.address.last_namehash , "street": conversionData.address.street , "city": conversionData.address.city , "region": conversionData.address.region , "postal_code": conversionData.address.postal_code , "country": conversionData.address.country } } }
- Next, check the ‘Include user-provided data from your website’ and select ‘New Variable’ from the dropdown.
- Name the variable as ‘User Provided Data’ and select ‘Code’ in the type since we are pushing PII information through code. Now from the data source we will select our ‘USER-DATA’ variable which contains the PII data and lastly click on save to save the variabel.
- Click on Trigger and select the trigger which fires on the order success page. For our module we push both the GA4 purchase event as well as Google Adwords Purchase on the order success page so we will use the remarketing tag purchase in a trigger group.
- You will see a warning on the tag which says ‘Conversion Linker Tag is missing’ click on the Create link next to it. It will automatically create the tag for you, simply name the tag and save.
- Now our GTM setup is ready, we can do a test purchase to make sure all the data is getting populated as well as our tag is firing correctly using the GTM preview mode. We can see in the below screenshot that our Google Ads Enhanced Conversion setup is working correctly.
Conclusion
This guide has enabled you to set up Google Ads Enhanced Conversion Tracking on your store. You can use the information provided in the guide to do the complete setup on your own. However, you will have to implement some code on your store if you are looking to do the setup all by yourself such as PII data as well as transaction ID, conversion value etc. If you do not want to go through the hassle of the entire setup you can check our Magento 2 Google Tag Manager extension which will implement all the necessary data layer code on your store once installed. We also provide GTM JSON import files which you can directly import and start using the tag immediately without having to perform all the steps mentioned above. You can see the demo and know for yourself:-
Frontend Demo
Backend Demo