Changeset 3443863
- Timestamp:
- 01/21/2026 09:04:36 AM (7 weeks ago)
- Location:
- metrion
- Files:
-
- 67 added
- 7 edited
-
tags/1.5.12 (added)
-
tags/1.5.12/assets (added)
-
tags/1.5.12/assets/icon-128x128.png (added)
-
tags/1.5.12/assets/icon-256x256.png (added)
-
tags/1.5.12/css (added)
-
tags/1.5.12/css/settings.css (added)
-
tags/1.5.12/includes (added)
-
tags/1.5.12/includes/api_endpoints.php (added)
-
tags/1.5.12/includes/event_capture.php (added)
-
tags/1.5.12/includes/initial.php (added)
-
tags/1.5.12/includes/js_bundler.php (added)
-
tags/1.5.12/js (added)
-
tags/1.5.12/js/bundles (added)
-
tags/1.5.12/js/cmp (added)
-
tags/1.5.12/js/cmp/cmplz (added)
-
tags/1.5.12/js/cmp/cmplz/logic.js (added)
-
tags/1.5.12/js/cmp/cookiebot (added)
-
tags/1.5.12/js/cmp/cookiebot/logic.js (added)
-
tags/1.5.12/js/cmp/cookieconfirm (added)
-
tags/1.5.12/js/cmp/cookieconfirm/logic.js (added)
-
tags/1.5.12/js/cmp/cookiefirst (added)
-
tags/1.5.12/js/cmp/cookiefirst/logic.js (added)
-
tags/1.5.12/js/cmp/cookiepal (added)
-
tags/1.5.12/js/cmp/cookiepal/logic.js (added)
-
tags/1.5.12/js/cmp/cookieyes (added)
-
tags/1.5.12/js/cmp/cookieyes/logic.js (added)
-
tags/1.5.12/js/cmp/moove_gdpr (added)
-
tags/1.5.12/js/cmp/moove_gdpr/logic.js (added)
-
tags/1.5.12/js/cmp/no_cmp (added)
-
tags/1.5.12/js/cmp/no_cmp/logic.js (added)
-
tags/1.5.12/js/cmp/onetrust (added)
-
tags/1.5.12/js/cmp/onetrust/logic.js (added)
-
tags/1.5.12/js/core (added)
-
tags/1.5.12/js/core/events.js (added)
-
tags/1.5.12/js/core/initialisation_sequence.js (added)
-
tags/1.5.12/js/detect (added)
-
tags/1.5.12/js/detect/detect.js (added)
-
tags/1.5.12/js/elementor (added)
-
tags/1.5.12/js/elementor/form_events.js (added)
-
tags/1.5.12/js/google_ads (added)
-
tags/1.5.12/js/google_ads/consent_mode.js (added)
-
tags/1.5.12/js/google_ads/events.js (added)
-
tags/1.5.12/js/google_analytics (added)
-
tags/1.5.12/js/google_analytics/events.js (added)
-
tags/1.5.12/js/meta (added)
-
tags/1.5.12/js/meta/events.js (added)
-
tags/1.5.12/js/microsoft_ads (added)
-
tags/1.5.12/js/microsoft_ads/consent_mode.js (added)
-
tags/1.5.12/js/microsoft_ads/events.js (added)
-
tags/1.5.12/js/settings (added)
-
tags/1.5.12/js/settings/settings.js (added)
-
tags/1.5.12/js/tiktok (added)
-
tags/1.5.12/js/tiktok/events.js (added)
-
tags/1.5.12/js/woo (added)
-
tags/1.5.12/js/woo/other_events.js (added)
-
tags/1.5.12/js/woo/purchase_event.js (added)
-
tags/1.5.12/main.php (added)
-
tags/1.5.12/readme.txt (added)
-
tags/1.5.12/uninstall.php (added)
-
tags/1.5.12/views (added)
-
tags/1.5.12/views/settings.php (added)
-
trunk/includes/initial.php (modified) (1 diff)
-
trunk/includes/js_bundler.php (modified) (4 diffs)
-
trunk/js/cmp/cookieconfirm (added)
-
trunk/js/cmp/cookieconfirm/logic.js (added)
-
trunk/js/core/events.js (modified) (3 diffs)
-
trunk/js/google_analytics (added)
-
trunk/js/google_analytics/events.js (added)
-
trunk/js/settings/settings.js (modified) (1 diff)
-
trunk/js/tiktok (added)
-
trunk/js/tiktok/events.js (added)
-
trunk/js/woo/other_events.js (modified) (2 diffs)
-
trunk/main.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
metrion/trunk/includes/initial.php
r3382453 r3443863 635 635 'google_analytics_enable_tracking' => get_option('metrion_google_analytics_enable_tracking', 0), 636 636 'google_analytics_measurement_id' => get_option('metrion_google_analytics_measurement_id', ''), 637 'google_analytics_api_secret' => get_option('metrion_google_analytics_api_secret', '') 637 'google_analytics_api_secret' => get_option('metrion_google_analytics_api_secret', ''), 638 'tiktok_enable_front_end_tracking' => get_option('metrion_tiktok_enable_front_end_tracking', ''), 639 'tiktok_pixel_id' => get_option('metrion_tiktok_pixel_id', ''), 640 'tiktok_test_event_code' => get_option('metrion_tiktok_test_event_code', '') 638 641 ]); 639 642 } -
metrion/trunk/includes/js_bundler.php
r3382453 r3443863 124 124 } 125 125 126 // Google Analytics extra events 127 if (strlen(get_option('metrion_google_analytics_measurement_id', '')) > 1 && !get_option('metrion_purchase_only_tracking', true)) { 128 $source_files[] = $plugin_dir . 'js/google_analytics/events.js'; 129 } 130 126 131 // Ensure output directory exists 127 132 if (!$wp_filesystem->is_dir($output_dir)) { … … 219 224 } 220 225 226 221 227 // Channel JS 222 228 if (get_option('metrion_google_enable_tracking', false)) { … … 230 236 if (get_option('metrion_meta_allow_front_end_pixel_tracking', false)) { 231 237 $source_files[] = $plugin_dir . 'js/meta/events.js'; 238 } 239 240 if (get_option('metrion_tiktok_enable_front_end_tracking', false)) { 241 $source_files[] = $plugin_dir . 'js/tiktok/events.js'; 242 } 243 244 // Google Analytics extra events 245 if (strlen(get_option('metrion_google_analytics_measurement_id', '')) > 1 && !get_option('metrion_purchase_only_tracking', true)) { 246 $source_files[] = $plugin_dir . 'js/google_analytics/events.js'; 232 247 } 233 248 … … 303 318 if (get_option('metrion_meta_allow_front_end_pixel_tracking', false)) { 304 319 $source_files[] = $plugin_dir . 'js/meta/events.js'; 320 } 321 322 if (get_option('metrion_tiktok_enable_front_end_tracking', false)) { 323 $source_files[] = $plugin_dir . 'js/tiktok/events.js'; 305 324 } 306 325 -
metrion/trunk/js/core/events.js
r3382453 r3443863 3 3 configuration: { 4 4 init_unix_timestamp: Date.now(), 5 last_interaction_unix_timestamp_ms: Date.now(),5 //last_interaction_unix_timestamp_ms: Date.now(), 6 6 cookie_value_separator: "--", 7 7 user_cookie_name: metrion_api.user_cookie_name + "_js", … … 702 702 current_stored_event["event_body"]["session_start_time"] = 703 703 window.metrion.session_manager.get_session_cookie_values()[2]; 704 current_stored_event["event_body"]["engaged_time_ms"] =705 current_stored_event["event_unix_timestamp"] -706 window.metrion.configuration.last_interaction_unix_timestamp_ms;707 window.metrion.configuration.last_interaction_unix_timestamp_ms =708 current_stored_event["event_unix_timestamp"];704 //current_stored_event["event_body"]["engaged_time_ms"] = 705 // current_stored_event["event_unix_timestamp"] - 706 // window.metrion.configuration.last_interaction_unix_timestamp_ms; 707 //window.metrion.configuration.last_interaction_unix_timestamp_ms = 708 // current_stored_event["event_unix_timestamp"]; 709 709 710 710 // Prepare for data sending to API … … 758 758 event_data["event_body"]["session_start_time"] = 759 759 window.metrion.session_manager.get_session_cookie_values()[2]; 760 event_data["event_body"]["engaged_time_ms"] =761 event_data["event_unix_timestamp"] -762 window.metrion.configuration.last_interaction_unix_timestamp_ms;760 //event_data["event_body"]["engaged_time_ms"] = 761 // event_data["event_unix_timestamp"] - 762 // window.metrion.configuration.last_interaction_unix_timestamp_ms; 763 763 764 764 // Don't reset the engaged time if the event is a non-interaction event 765 if (766 event_data["event_body"].hasOwnProperty("non_interaction") &&767 event_data["event_body"]["non_interaction"] !== "1"768 ) {769 window.metrion.configuration.last_interaction_unix_timestamp_ms =770 event_data["event_unix_timestamp"];771 }765 //if ( 766 // event_data["event_body"].hasOwnProperty("non_interaction") && 767 // event_data["event_body"]["non_interaction"] !== "1" 768 //) { 769 // window.metrion.configuration.last_interaction_unix_timestamp_ms = 770 // event_data["event_unix_timestamp"]; 771 //} 772 772 773 773 // If consent cookie is available and floodgate open, handle based on the metrion consent cookie. Otherwise the event will be floodgated later -
metrion/trunk/js/settings/settings.js
r3342931 r3443863 50 50 }); 51 51 52 // Google Analytics options53 var google_analytics_button = document.getElementById('google-analytics-settings-toggle');54 var google_analytics_settings = document.getElementById('google-analytics-settings');55 56 google_analytics_button.addEventListener('click', function() {57 const isHiddenMetaAds = google_analytics_settings.style.display === 'none';58 google_analytics_settings.style.display = isHiddenMetaAds ? 'block' : 'none';59 google_analytics_button.textContent = `Google Analytics Configuration Settings ${isHiddenMetaAds ? '▲' : '▼'}`;60 });61 52 }); -
metrion/trunk/js/woo/other_events.js
r3342931 r3443863 10 10 // Add-to-cart listener 11 11 $("body").on("click", ".add_to_cart_button, .single_add_to_cart_button", function (event) { 12 var google_analytics_enabled = window.metrion.google_analytics !== undefined; 13 var event_unix = Date.now(); 14 var engagement_time_msec = 500; 15 if(google_analytics_enabled){ 16 engagement_time_msec = (event_unix - window.metrion.google_analytics.latest_engagement_unix); 17 } 18 12 19 try { 13 20 var product_id, product_name, product_price, product_regular_price, product_sku, quantity = 1; … … 74 81 metrion.send_event("add_to_cart", { 75 82 "items": [product_data], 76 "trigger_type": "front-end" 83 "trigger_type": "front-end", 84 "engaged_time_ms": engagement_time_msec 77 85 }); 78 86 } else { -
metrion/trunk/main.php
r3406662 r3443863 3 3 * Plugin Name: Metrion 4 4 * Description: Skip manual implementation, sync data directly tailored to destinations like Google Ads and Meta Ads. 5 * Version: 1.5.1 15 * Version: 1.5.12 6 6 * Author: Metrion 7 7 * Author URI: https://getmetrion.com … … 12 12 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 13 13 14 define('GLOBAL_METRION_PLUGIN_VERSION', '1.5.1 1');14 define('GLOBAL_METRION_PLUGIN_VERSION', '1.5.12'); 15 15 16 16 require_once plugin_dir_path(__FILE__) . 'includes/js_bundler.php'; … … 72 72 add_option('metrion_meta_test_event_code', ''); // Open field for Meta Test event code 73 73 74 // TikTok Ads destination options 75 add_option('metrion_tiktok_sync_enabled', 0); // Check whether a TikTok Sync available is 76 add_option('metrion_tiktok_enable_front_end_tracking', 0); // Enable Tiktok Front-end tracking 77 add_option('metrion_tiktok_pixel_id', ''); // Open field for the TikTok Ads pixel ID 78 add_option('metrion_tiktok_test_event_code', ''); // Open field for the TikTok Ads event code 74 79 75 80 // Microsoft Ads destination options … … 82 87 add_option('metrion_google_analytics_enable_tracking', 0); // Default setting for enabling Google Analytics 83 88 add_option('metrion_google_analytics_measurement_id', ''); // Open field for the measurement ID 84 add_option('metrion_google_analytics_api_secret', ''); // Open field for the API key 85 86 89 add_option('metrion_google_analytics_api_secret', ''); // Open field for the API key 87 90 88 91 // Advanced settings … … 188 191 if ($status_code === 200) { 189 192 $body = json_decode(wp_remote_retrieve_body($response), true); 190 if (isset($body['active']) ) {193 if (isset($body['active']) && $body['active'] === true) { 191 194 update_option('metrion_credentials_valid', true); 192 195 update_option('metrion_installation_id', sanitize_text_field($body['installationId'])); … … 211 214 update_option('metrion_meta_allow_front_end_pixel_tracking', !empty($pixelId)); 212 215 update_option('metrion_meta_pixel_id', $pixelId); 216 217 // TikTok Ads settings 218 $tikTokAdsSync = array_filter($body['syncs'] ?? [], fn($s) => $s['destination'] === 'TikTokAds'); 219 update_option('metrion_tiktok_sync_enabled', in_array('TikTokAds', array_column($body['syncs'], 'destination'))); 220 $pixelId = $tikTokAdsSync ? reset($tikTokAdsSync)['pixelId'] ?? '' : ''; 221 update_option('metrion_tiktok_enable_front_end_tracking', !empty($pixelId)); 222 update_option('metrion_tiktok_pixel_id', $pixelId); 213 223 214 224 // Google Analytics settings -
metrion/trunk/readme.txt
r3406662 r3443863 4 4 Requires at least: 3.8 5 5 Tested up to: 6.8 6 Stable tag: 1.5.1 16 Stable tag: 1.5.12 7 7 Requires PHP: 7.1 8 8 License: GPLv3 or later … … 68 68 When Google Ads tracking is activated, this plugin loads and connects with to Google Ads' tracking pixels and APIs. Based on the Google Ads settings in Metrion's, the user interaction data can be shared with Google Ads. 69 69 70 Read more about our[terms of use](https://support.google.com/adspolicy/answer/54818?hl=en) and [privacy policy](https://policies.google.com/privacy).70 Read more about the [terms of use](https://support.google.com/adspolicy/answer/54818?hl=en) and [privacy policy](https://policies.google.com/privacy). 71 71 72 72 = Meta Ads Tracking = 73 73 When Meta Ads tracking is activated, this plugin loads and connects with to Meta Ads' tracking pixels and APIs. Based on the Meta Ads settings in Metrion's, the user interaction data can be shared with Meta Ads. 74 74 75 Read more about our[terms of use](https://www.facebook.com/business/direct_terms_ads_en.php) and [privacy policy](https://www.facebook.com/privacy/policy/).75 Read more about the [terms of use](https://www.facebook.com/business/direct_terms_ads_en.php) and [privacy policy](https://www.facebook.com/privacy/policy/). 76 76 77 77 = Microsoft Ads Tracking = 78 78 When Microsoft Ads tracking is activated, this plugin loads and connects with to Microsoft Ads' tracking pixels and APIs. Based on the Microsoft Ads settings in Metrion's, the user interaction data can be shared with Microsoft Ads. 79 79 80 Read more about our [terms of use](https://www.microsoft.com/en/servicesagreement) and [privacy policy](https://www.microsoft.com/en-us/privacy/privacystatement). 80 Read more about the [terms of use](https://www.microsoft.com/en/servicesagreement) and [privacy policy](https://www.microsoft.com/en-us/privacy/privacystatement). 81 82 = TikTok Ads Tracking = 83 When TikTok Ads tracking is activated, this plugin loads and connects with to TikTok Ads' tracking pixels and APIs. Based on the TikTok Ads settings in Metrion's, the user interaction data can be shared with TikTok Ads. 84 85 Read more about the [terms, policies and guidelines](https://ads.tiktok.com/i18n/official/policy/terms) and [privacy policy](https://www.tiktok.com/legal/page/us/privacy-policy/en). 81 86 82 87 == Screenshots == … … 87 92 88 93 == Changelog == 94 95 = 1.5.12 = 96 - Added support for TikTok Ads tracking 97 - Improved controlling of active sync settings 98 - Added suppport for CookieConfirm CMP 99 - Added additional events for engagement time calculation in GA4 89 100 90 101 = 1.5.11 =
Note: See TracChangeset
for help on using the changeset viewer.