Collect UTMs in Easy Digital Downloads Orders
UTM attribution overview
Store HandL UTM Grabber attribution on Easy Digital Downloads orders using hidden checkout fields and order meta. Same pattern as WooCommerce.
Overview
Easy Digital Downloads (EDD) does not natively store UTM data. HandL UTM Grabber captures attribution in cookies. You pass it into checkout via hidden fields and save to order meta.
Step 1: Add hidden checkout fields
Use EDD's checkout field filters or a snippets plugin to inject hidden fields for each UTM parameter. Name fields to match UTM Grabber cookies: utm_source, utm_medium, utm_campaign, gclid, etc.
Step 2: Auto-populate fields
UTM Grabber automatically fills hidden inputs on the checkout page. Alternatively use shortcodes: [utm_source], [gclid], etc. See Native WP Shortcodes.
Step 3: Save to order meta
add_action('edd_insert_payment', function($payment_id) {
$fields = ['utm_source','utm_medium','utm_campaign','gclid','fbclid'];
foreach ($fields as $f) {
if (!empty($_POST[$f])) {
edd_update_payment_meta($payment_id, $f, sanitize_text_field($_POST[$f]));
}
}
});
For webhook-based attribution to your CRM, see the second guide in this book.