Setting and verifying Google Analytics 4 Enhanced Conversions
One of the toughest tasks we had recently was to implement Google Analytics 4 Enhanced Conversions and moreover verify that it's actually working. There are a lot of tutorials and videos out there but almost none of them is providing real-world example how to implement and test.
I'm creating this quick article of all those poor souls like us that we banged our heads around for days untill we figure what is going on. So, let's get started.
Prerequisites
In this article we shall review Google Analytics 4 conversion tracking and Enhanced Conversions support via pure gtag.js(), for those running Google Tag Manager, I shall prepare a spearate article.
gtag() is installed via a snippet code which you can copy from your Google Ads Account, the only difference however is to enable allow_enhanced_conversions option as shown below. This ensures that any user_data and enhanced_conversion data would be automatically hashed() as per Google's requirements
This code above is sufficient to install gtag() on success page and disable send_page_view to avoid duplicate pages (if you have GTM installed in parallel)
Google Ads Conversion Tracking (with Enhanced Conversions Support)
Now onto conversion tracking snippet. The snippet required for conversion tracking is shown below. As you can see we need to set pass user_data
This tells the gtag() api to send also user_data with the conversion request. There is no need to hash this data because allow_enhanced_conversions is seto Yes already.
Verifying Enhanced Conversions
Now onto verification. It is important as developer to verify that enhanced conversions are being set. To do so, use Chorme Developer Tools (F12 in Chrome), do not use Firefox, it won't show fetch() requests.
When in Developer Tools, go to Network, then in the filter insert: googleadservices.com/pagead/conversion to filter out other requests and show only Google Ads Conversion requests. Then navigate to Payload and review the payload parmameters.
The most important one is: em This is the hashed email, which is what Enhanced Conversions uses and inticates tha User Provided Data exists in the Conversion Request.
Another parameters indicating that Enhanced Conversion are working also include:
ec_mode
This parameters indicates User Provided Data Collection Mode. It has 2 values
1. ec_mode 'c' indicates In Page code, this means that user_data has been explicitly provided in the page (in our case by using gtag('set','user_data',{}). This is the recommended way by Google for being more accurate and less prone to errors.
2. ec_mode 'a' indicates automatic user data collection
capi: 1 suggests that the Conversion API / server-side processing is enabled, which aligns with Enhanced Conversions