Changeset 3457833
- Timestamp:
- 02/10/2026 09:54:24 AM (4 weeks ago)
- Location:
- metrion
- Files:
-
- 62 added
- 4 edited
-
tags/1.6.3 (added)
-
tags/1.6.3/assets (added)
-
tags/1.6.3/assets/icon-128x128.png (added)
-
tags/1.6.3/assets/icon-256x256.png (added)
-
tags/1.6.3/css (added)
-
tags/1.6.3/css/settings.css (added)
-
tags/1.6.3/includes (added)
-
tags/1.6.3/includes/api_endpoints.php (added)
-
tags/1.6.3/includes/event_capture.php (added)
-
tags/1.6.3/includes/initial.php (added)
-
tags/1.6.3/includes/js_bundler.php (added)
-
tags/1.6.3/js (added)
-
tags/1.6.3/js/cmp (added)
-
tags/1.6.3/js/cmp/cmplz (added)
-
tags/1.6.3/js/cmp/cmplz/logic.js (added)
-
tags/1.6.3/js/cmp/cookiebot (added)
-
tags/1.6.3/js/cmp/cookiebot/logic.js (added)
-
tags/1.6.3/js/cmp/cookieconfirm (added)
-
tags/1.6.3/js/cmp/cookieconfirm/logic.js (added)
-
tags/1.6.3/js/cmp/cookiefirst (added)
-
tags/1.6.3/js/cmp/cookiefirst/logic.js (added)
-
tags/1.6.3/js/cmp/cookiepal (added)
-
tags/1.6.3/js/cmp/cookiepal/logic.js (added)
-
tags/1.6.3/js/cmp/cookieyes (added)
-
tags/1.6.3/js/cmp/cookieyes/logic.js (added)
-
tags/1.6.3/js/cmp/moove_gdpr (added)
-
tags/1.6.3/js/cmp/moove_gdpr/logic.js (added)
-
tags/1.6.3/js/cmp/no_cmp (added)
-
tags/1.6.3/js/cmp/no_cmp/logic.js (added)
-
tags/1.6.3/js/cmp/onetrust (added)
-
tags/1.6.3/js/cmp/onetrust/logic.js (added)
-
tags/1.6.3/js/core (added)
-
tags/1.6.3/js/core/events.js (added)
-
tags/1.6.3/js/core/initialisation_sequence.js (added)
-
tags/1.6.3/js/detect (added)
-
tags/1.6.3/js/detect/detect.js (added)
-
tags/1.6.3/js/elementor (added)
-
tags/1.6.3/js/elementor/form_events.js (added)
-
tags/1.6.3/js/google_ads (added)
-
tags/1.6.3/js/google_ads/consent_mode.js (added)
-
tags/1.6.3/js/google_ads/events.js (added)
-
tags/1.6.3/js/google_analytics (added)
-
tags/1.6.3/js/google_analytics/events.js (added)
-
tags/1.6.3/js/meta (added)
-
tags/1.6.3/js/meta/events.js (added)
-
tags/1.6.3/js/microsoft_ads (added)
-
tags/1.6.3/js/microsoft_ads/consent_mode.js (added)
-
tags/1.6.3/js/microsoft_ads/events.js (added)
-
tags/1.6.3/js/myyounit (added)
-
tags/1.6.3/js/myyounit/integration.js (added)
-
tags/1.6.3/js/settings (added)
-
tags/1.6.3/js/settings/settings.js (added)
-
tags/1.6.3/js/tiktok (added)
-
tags/1.6.3/js/tiktok/events.js (added)
-
tags/1.6.3/js/woo (added)
-
tags/1.6.3/js/woo/other_events.js (added)
-
tags/1.6.3/js/woo/purchase_event.js (added)
-
tags/1.6.3/main.php (added)
-
tags/1.6.3/readme.txt (added)
-
tags/1.6.3/uninstall.php (added)
-
tags/1.6.3/views (added)
-
tags/1.6.3/views/settings.php (added)
-
trunk/includes/js_bundler.php (modified) (6 diffs)
-
trunk/js/myyounit/integration.js (modified) (1 diff)
-
trunk/main.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
metrion/trunk/includes/js_bundler.php
r3453715 r3457833 113 113 } 114 114 115 // MyYounit integration 116 if (get_option('metrion_enable_myyounit_integration', false)) { 117 $source_files[] = $plugin_dir . 'js/myyounit/integration.js'; 118 } 119 115 120 // WooCommerce tracking 116 121 if (get_option('metrion_enable_woocommerce_tracking', false)) { … … 120 125 $source_files[] = $plugin_dir . 'js/woo/other_events.js'; 121 126 } 122 }123 124 // MyYounit integration125 if (get_option('metrion_enable_myyounit_integration', false)) {126 $source_files[] = $plugin_dir . 'js/myyounit/integration.js';127 127 } 128 128 … … 172 172 // translators: %s is the file path that could not be read. 173 173 return new WP_Error('read_failed', sprintf(__('Failed to read source file: %s', 'metrion'), esc_html($file))); 174 } 175 176 if (strpos($file, "myyounit") !== false) { 177 $installation_id = get_option('metrion_installation_id', ''); 178 $content = str_replace('__INSTALLATION_ID_H__', esc_js($installation_id), $content); 174 179 } 175 180 … … 217 222 $source_files[] = $plugin_dir . 'js/cmp/' . $cmp_selection . '/logic.js'; 218 223 } 224 225 // MyYounit integration 226 if (get_option('metrion_enable_myyounit_integration', false)) { 227 $source_files[] = $plugin_dir . 'js/myyounit/integration.js'; 228 } 219 229 220 230 // WooCommerce tracking … … 225 235 $source_files[] = $plugin_dir . 'js/woo/other_events.js'; 226 236 } 227 }228 229 // MyYounit integration230 if (get_option('metrion_enable_myyounit_integration', false)) {231 $source_files[] = $plugin_dir . 'js/myyounit/integration.js';232 237 } 233 238 … … 295 300 // translators: %s is the file path that could not be read. 296 301 return new WP_Error('read_failed', sprintf(__('Failed to read source file: %s', 'metrion'), esc_html($file))); 302 } 303 304 if (strpos($file, "myyounit") !== false) { 305 $installation_id = get_option('metrion_installation_id', ''); 306 $content = str_replace('__INSTALLATION_ID_H__', esc_js($installation_id), $content); 297 307 } 298 308 -
metrion/trunk/js/myyounit/integration.js
r3453715 r3457833 2 2 3 3 window.metrion.append_cookies_for_myyounit = function () { 4 let aTags = document.querySelectorAll("a"); 5 let me_uid = window.metrion.user_manager.get_user_cookie_values()[0]; 6 let me_sid = window.metrion.session_manager.get_session_cookie_values()[0]; 7 let me_installation_id = window.metrion_api.installation_id; 8 for (let a of aTags) { 9 if (!a.href || !a.href.includes("myyounit.nl")) continue; 10 var newUrl = new URL(a.href); 11 if (!a.href.includes("metrion_uid")) { 12 newUrl.searchParams.append("metrion_uid", me_uid); 4 let aTags = document.querySelectorAll("a"); 5 6 let me_uid = window.metrion?.user_manager?.get_user_cookie_values()?.[0]; 7 let me_sid = window.metrion?.session_manager?.get_session_cookie_values()?.[0]; 8 let me_installation_id = "__INSTALLATION_ID_H__"; 9 if (!me_installation_id || me_installation_id === "") { 10 me_installation_id = window.metrion_api?.installation_id; 11 } 12 13 for (let a of aTags) { 14 if (!a.href || !a.href.includes("myyounit.nl")) continue; 15 16 try { 17 var newUrl = new URL(a.href); 18 19 if (me_uid && !newUrl.searchParams.has("metrion_uid")) { 20 newUrl.searchParams.append("metrion_uid", me_uid); 21 } 22 if (me_sid && !newUrl.searchParams.has("metrion_sid")) { 23 newUrl.searchParams.append("metrion_sid", me_sid); 24 } 25 if (me_installation_id && !newUrl.searchParams.has("metrion_installation_id")) { 26 newUrl.searchParams.append("metrion_installation_id", me_installation_id); 27 } 28 29 a.href = newUrl.toString(); 30 } catch (e) { } 31 } 32 }; 33 34 window.metrion._myyHandleLinkClick = function (e) { 35 const link = e.target.closest('a[href*="myyounit.nl"]'); 36 if (!link) return; 37 38 window.metrion.append_cookies_for_myyounit(); 39 40 if (e.button === 1 || e.ctrlKey || e.metaKey || e.shiftKey) { 41 return; 42 } 43 44 if (e.button === 0) { 45 e.preventDefault(); 46 window.location.href = link.href; 47 } 48 }; 49 50 window.metrion._myyHandleKeydown = function (e) { 51 if (e.key !== "Enter") return; 52 53 const link = e.target.closest('a[href*="myyounit.nl"]'); 54 if (!link) return; 55 56 window.metrion.append_cookies_for_myyounit(); 57 e.preventDefault(); 58 window.location.href = link.href; 59 }; 60 61 window.metrion._myySetupObserver = function () { 62 if (window.metrion._observer) return; 63 64 window.metrion._observer = new MutationObserver((mutations) => { 65 let shouldUpdate = false; 66 67 for (const mutation of mutations) { 68 for (const node of mutation.addedNodes) { 69 if (node.nodeType !== Node.ELEMENT_NODE) continue; 70 71 if (node.matches?.('a[href*="myyounit.nl"]') || 72 node.querySelector?.('a[href*="myyounit.nl"]')) { 73 shouldUpdate = true; 74 break; 13 75 } 14 if (!a.href.includes("metrion_sid")) { 15 newUrl.searchParams.append("metrion_sid", me_sid); 76 } 77 if (shouldUpdate) break; 78 } 79 80 if (shouldUpdate) { 81 window.metrion.append_cookies_for_myyounit(); 82 } 83 }); 84 85 window.metrion._observer.observe(document.body, { 86 childList: true, 87 subtree: true 88 }); 89 }; 90 91 window.metrion._myyEnsureInitialized = function () { 92 const maxAttempts = 10; 93 const interval = 300; 94 let attempts = 0; 95 96 const tryInit = () => { 97 attempts++; 98 99 if (window.metrion_api?.installation_id) { 100 window.metrion.append_cookies_for_myyounit(); 101 return; 102 } 103 104 if (attempts < maxAttempts) { 105 setTimeout(tryInit, interval); 106 } else { 107 if (window.metrion) { 108 window.metrion.send_event("metrion_api_failed", { 109 message: "Something went wrong reading metrion_api", 110 }); 16 111 } 17 if (!a.href.includes("metrion_installation_id")) {18 newUrl.searchParams.append("metrion_installation_id", me_installation_id);19 }20 a.href = newUrl.toString();21 112 } 113 }; 114 115 tryInit(); 116 }; 117 118 window.metrion._myyInit = function () { 119 document.removeEventListener("click", window.metrion._myyHandleLinkClick); 120 document.removeEventListener("auxclick", window.metrion._myyHandleLinkClick); 121 document.removeEventListener("keydown", window.metrion._myyHandleKeydown); 122 123 document.addEventListener("click", window.metrion._myyHandleLinkClick); 124 document.addEventListener("auxclick", window.metrion._myyHandleLinkClick); 125 document.addEventListener("keydown", window.metrion._myyHandleKeydown); 126 127 window.metrion._myySetupObserver(); 128 129 window.metrion._myyEnsureInitialized(); 130 }; 131 132 if (document.readyState === "loading") { 133 document.addEventListener("DOMContentLoaded", window.metrion._myyInit); 134 } else { 135 window.metrion._myyInit(); 22 136 } 23 24 window.metrion.append_cookies_for_myyounit();25 26 addEventListener("click", () => {27 window.metrion.append_cookies_for_myyounit();28 }); -
metrion/trunk/main.php
r3453910 r3457833 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.6. 25 * Version: 1.6.3 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.6. 2');14 define('GLOBAL_METRION_PLUGIN_VERSION', '1.6.3'); 15 15 16 16 require_once plugin_dir_path(__FILE__) . 'includes/js_bundler.php'; -
metrion/trunk/readme.txt
r3453910 r3457833 4 4 Requires at least: 3.8 5 5 Tested up to: 6.8 6 Stable tag: 1.6. 26 Stable tag: 1.6.3 7 7 Requires PHP: 7.1 8 8 License: GPLv3 or later … … 93 93 == Changelog == 94 94 95 = 1.6.3 = 96 - Improved integration with MyYounit 97 95 98 = 1.6.2 = 96 99 - Collection preparations for Klaviyo
Note: See TracChangeset
for help on using the changeset viewer.