diff --git a/btn-1cc-checkout.js b/btn-1cc-checkout.js index 7c8ed32f..2a8b812a 100644 --- a/btn-1cc-checkout.js +++ b/btn-1cc-checkout.js @@ -8,6 +8,9 @@ window.addEventListener('DOMContentLoaded', function() { var pageURL = jQuery(location).attr('href'); var url = new URL(pageURL); var accessToken = new URLSearchParams(url.search).get('wcf_ac_token'); + var referrerDomain = document.referrer.toString(); + + rzp1ccCheckoutData.referrerDomain = referrerDomain; // event triggered by wc on any cart change // as input function is the same, duplicate event listeners are NOT called diff --git a/includes/api/order.php b/includes/api/order.php index c5156592..d803950b 100644 --- a/includes/api/order.php +++ b/includes/api/order.php @@ -274,11 +274,21 @@ function wooSaveCheckoutUTMFields($orderId, $params) { $pysData = []; $cookieData = $params['cookies']; + $getQuery = $params['requestData']; $browserTime = $params['dateTime']; $pysData['pys_landing'] = isset($cookieData['pys_landing_page']) ? ($cookieData['pys_landing_page']) : ""; $pysData['pys_source'] = isset($cookieData['pysTrafficSource']) ? ($cookieData['pysTrafficSource']) : "direct"; + if($pysData['pys_source'] == 'direct') + { + $pysData['pys_source'] = $params['referrerDomain'] != '' ? $params['referrerDomain'] : "direct"; + } + $pysUTMSource = $cookieData['pys_utm_source'] ?? $getQuery['utm_source']; + $pysUTMMedium = $cookieData['pys_utm_medium'] ?? $getQuery['utm_medium']; + $pysUTMCampaign = $cookieData['pys_utm_campaign'] ?? $getQuery['utm_medium']; + $pysUTMTerm = $cookieData['pys_utm_term'] ?? $getQuery['utm_term']; + $pysUTMContent = $cookieData['pys_utm_content'] ?? $getQuery['utm_content']; - $pysData['pys_utm'] = "utm_source:" . $cookieData['pys_utm_source'] . "|utm_medium:" . $cookieData['pys_utm_medium'] . "|utm_campaign:" . $cookieData['pys_utm_campaign'] . "|utm_term:" . $cookieData['pys_utm_term'] . "|utm_content:" . $cookieData['pys_utm_content']; + $pysData['pys_utm'] = "utm_source:" . $pysUTMSource . "|utm_medium:" . $pysUTMMedium . "|utm_campaign:" . $pysUTMCampaign . "|utm_term:" . $pysUTMTerm . "|utm_content:" . $pysUTMContent; $pysData['pys_browser_time'] = $browserTime[0] . "|" . $browserTime[1] . "|" . $browserTime[2]; update_post_meta($orderId, "pys_enrich_data", $pysData); diff --git a/readme.txt b/readme.txt index 57e5789d..743e5127 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: razorpay Tags: razorpay, payments, india, woocommerce, ecommerce Requires at least: 3.9.2 Tested up to: 5.9 -Stable tag: 3.8.2 +Stable tag: 3.8.3 Requires PHP: 5.6 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -41,6 +41,9 @@ This is compatible with WooCommerce>=2.4, including the new 3.0 release. It has == Changelog == += 3.8.3 = +* Bug fix for UTM data for pixel your site plugin for magic checkout. + = 3.8.2 = * Bug fix for blog name in magic checkout. diff --git a/woo-razorpay.php b/woo-razorpay.php index ec94709e..80daacbf 100644 --- a/woo-razorpay.php +++ b/woo-razorpay.php @@ -3,8 +3,8 @@ * Plugin Name: Razorpay for WooCommerce * Plugin URI: https://razorpay.com * Description: Razorpay Payment Gateway Integration for WooCommerce - * Version: 3.8.2 - * Stable tag: 3.8.2 + * Version: 3.8.3 + * Stable tag: 3.8.3 * Author: Team Razorpay * WC tested up to: 6.4.1 * Author URI: https://razorpay.com @@ -1929,6 +1929,7 @@ function enqueueScriptsFor1cc() 'siteurl' => $siteurl, 'blogname' => get_bloginfo('name'), 'cookies' => $_COOKIE, + 'requestData' => $_REQUEST, ) ); wp_enqueue_script('btn_1cc_checkout'); }