Last active
September 28, 2023 13:47
-
-
Save PechenkiUA/d69f09d4517029ca038b4e3e3c1b81f2 to your computer and use it in GitHub Desktop.
Telsender UTM Leads Tracker - XLPlugins Woocomerse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* {utm_source} | |
* {utm_medium} | |
* {utm_campaign} | |
*/ | |
add_filter('tscf_filter_codetemplate', function ($list, $order_id) { | |
$order = wc_get_order($order_id); | |
$utm = get_post_meta($order->get_id(), 'before_order_cookie_xlutm_params_utm', true); | |
if (!$utm) return $list; | |
$utm = array_pop($utm); | |
if ($utm) { | |
foreach ($utm as $key => $name) { | |
$list['{' . $key . '}'] = sprintf('%s: %s',$key,$name); | |
} | |
} | |
return $list; | |
}, 20, 2); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment