Feature Description
Implement Enhanced Conversions support by hooking into the edd_complete_purchase event. This allows Site Kit to capture user data from Easy Digital Downloads purchases and send it for conversion attribution.
Refer to the Plugin Event Integration for more details.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When a supported conversion event (e.g., purchase completion) occurs via Easy Digital Downloads, Site Kit should track the event and include any available user data (e.g., email, name, phone) in the event payload.
- The event should be sent using Site Kit’s internal
gtagEvent mechanism.
- The user data should be normalized but not hashed, following the official Google guidelines for normalization.
- User data should only be included if it can be reliably extracted.
- User data should be sent if it has at least one supported field.
- User data shouldn't be sent if it has no supported fields.
- This behavior should only occur when the
gtagUserData feature flag is enabled.
- Refer to Enhanced Conversions Fields Reference for the full list of supported fields.
Implementation Brief
In includes/Core/Conversion_Tracking/Conversion_Event_Providers/Easy_Digital_Downloads.php:
In assets/js/event-providers/easy-digital-downloads.js:
Test Coverage
- Update existing EDD provider tests to verify the
get_event_names method returns 'add_to_cart' by default and conditionally includes 'purchase' when the gtagUserData feature flag is enabled.
- Add tests for the
get_enhanced_conversions_data_from_session method to verify it returns an empty array when the feature flag is disabled (can be tested without EDD dependencies).
QA Brief
- Set up Site Kit with Analytics/Ads and enable conversion tracking.
- Enable the
gtagUserData feature flag.
- Set up Easy Digital Downloads
- Create a product with a price above 0
- Enable test mode by going to Downloads -> Payments -> enable Enable Test Mode and enable "Store gateway" in "Active Gateways"
- Go to Payments -> Checkout and enable all the fields in "Checkout Address Fields"
- Go to the product page, add it to the cart and go to the checkout page
- Using Tag Assistant, verify
purchase event is registered after completing the checkout, and its data_layer has the following content :
{
"address": {
"first_name": "...",
"last_name": "...",
"street": "...",
"city": "...",
"region": "...",
"postal_code": "...",
"country": "..."
},
"email": "...",
"phone_number": "..."
}
Changelog entry
- Add Enhanced Conversions support for Easy Digital Downloads by capturing and sending user data.
Feature Description
Implement Enhanced Conversions support by hooking into the
edd_complete_purchaseevent. This allows Site Kit to capture user data from Easy Digital Downloads purchases and send it for conversion attribution.Refer to the Plugin Event Integration for more details.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
gtagEventmechanism.gtagUserDatafeature flag is enabled.Implementation Brief
In
includes/Core/Conversion_Tracking/Conversion_Event_Providers/Easy_Digital_Downloads.php:get_event_namesmethod to returnarray( 'add_to_cart' )by default, and conditionally include'purchase'only when thegtagUserDatafeature flag is enabled.register_hooksmethod to:gtagUserDatafeature flag is enabled.wp_footeraction that callsmaybe_add_purchase_data_from_sessionto add purchase data on completion pages.maybe_add_purchase_data_from_sessionmethod that:edd_is_success_page()to detect EDD purchase completion pages.edd_get_purchase_session()to retrieve purchase data from the EDD session.get_enhanced_conversions_data_from_sessionto extract user data.get_enhanced_conversions_data_from_sessionmethod that:extract_user_data_from_sessionto extract and normalize user data.array( 'user_data' => $user_data )if user data is available, or an empty array if not.extract_user_data_from_sessionmethod to extract customer data from EDD session data and normalize it using theEnhanced_Conversionsclass methods. Do not hash the data.user_dataobject using the following supported fields available in EDD session:email(fromsession_data['user_email']orsession_data['user_info']['email'])phone_number(fromsession_data['user_info']['address']['phone'])address.first_name(fromsession_data['user_info']['first_name'])address.last_name(fromsession_data['user_info']['last_name'])address.street(fromsession_data['user_info']['address']['line1'])address.city(fromsession_data['user_info']['address']['city'])address.region(fromsession_data['user_info']['address']['state'])address.postal_code(fromsession_data['user_info']['address']['zip'])address.country(fromsession_data['user_info']['address']['country'])In
assets/js/event-providers/easy-digital-downloads.js:edd_cart_item_addedevent handling logic without modification.global._googlesitekit.edddata.purchaseif available.gtagUserDatafeature flag is enabled usingglobal._googlesitekit?.gtagUserData.purchaseevent with the user data usinggtagEventwhen both the feature flag is enabled and user data is available.user_dataproperty if no valid user data is available.user_dataeven if it has only one supported field.Test Coverage
get_event_namesmethod returns'add_to_cart'by default and conditionally includes'purchase'when thegtagUserDatafeature flag is enabled.get_enhanced_conversions_data_from_sessionmethod to verify it returns an empty array when the feature flag is disabled (can be tested without EDD dependencies).QA Brief
gtagUserDatafeature flag.purchaseevent is registered after completing the checkout, and itsdata_layerhas the following content :{ "address": { "first_name": "...", "last_name": "...", "street": "...", "city": "...", "region": "...", "postal_code": "...", "country": "..." }, "email": "...", "phone_number": "..." }Changelog entry