Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Override Google Analytics Pro event name for renewal purchases
<?php
function sv_wc_google_analytics_pro_set_completed_renewal_purchase_event( $parameters ) {
if ( 'completed purchase' === $parameters['ea'] ) {
$order_id = (int) $parameters['el'];
if ( WC_Subscriptions_Renewal_Order::is_renewal( $order_id ) ) {
$parameters['ea'] = 'completed renewal purchase';
}
}
return $parameters;
}
add_filter( 'wc_google_analytics_pro_api_event_parameters', 'sv_wc_google_analytics_pro_set_completed_renewal_purchase_event', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.