Changeset 3288049
- Timestamp:
- 05/05/2025 07:40:55 PM (10 months ago)
- Location:
- metrion/trunk
- Files:
-
- 3 added
- 10 edited
-
assets/icon-128x128.png (added)
-
assets/icon-256x256.png (added)
-
core.php (modified) (5 diffs)
-
includes/event_capture.php (modified) (2 diffs)
-
includes/initial.php (modified) (5 diffs)
-
js/detect.js (added)
-
js/events.js (modified) (23 diffs)
-
js/google_ads/events.js (modified) (5 diffs)
-
js/meta/events.js (modified) (2 diffs)
-
js/microsoft_ads/events.js (modified) (3 diffs)
-
readme.txt (modified) (6 diffs)
-
uninstall.php (modified) (1 diff)
-
views/settings.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
metrion/trunk/core.php
r3251175 r3288049 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. 0.05 * Version: 1.1.0 6 6 * Author: Metrion 7 7 * Author URI: https://getmetrion.com … … 31 31 add_option('metrion_click_ids_cookie_name', 'mtrn_cids'); // Default click IDs cookie name 32 32 add_option('metrion_session_info_storage_name', 'mtrn_session_info'); // Default session info storage name 33 add_option('metrion_allow_pre_consent_pings', 0); // Default value for pre-consent ping counting 34 add_option('metrion_enable_block_detection', 0); // Default value for block detection 33 35 34 36 // Consent management settings … … 67 69 register_setting('metrion_options_group', 'metrion_customer_api_key', ['sanitize_callback' => 'sanitize_text_field']); 68 70 69 70 71 register_setting('metrion_options_group', 'metrion_webhook_destination', ['sanitize_callback' => 'esc_url_raw']); 71 72 register_setting('metrion_options_group', 'metrion_api_path_part_1', ['sanitize_callback' => 'sanitize_text_field']); … … 83 84 register_setting('metrion_options_group', 'metrion_click_ids_cookie_name', ['sanitize_callback' => 'sanitize_key']); 84 85 register_setting('metrion_options_group', 'metrion_session_info_storage_name', ['sanitize_callback' => 'sanitize_key']); 86 87 register_setting('metrion_options_group', 'metrion_allow_pre_consent_pings', ['sanitize_callback' => 'rest_sanitize_boolean']); 88 register_setting('metrion_options_group', 'metrion_enable_block_detection', ['sanitize_callback' => 'rest_sanitize_boolean']); 85 89 86 90 // Register the consent management settings … … 150 154 151 155 // Get the file modification time for cache busting 152 $script_version = file_exists($script_path) ? filemtime($script_path) : '1. 0.0';156 $script_version = file_exists($script_path) ? filemtime($script_path) : '1.1.0'; 153 157 154 158 // Enqueue admin script -
metrion/trunk/includes/event_capture.php
r3251175 r3288049 136 136 $billing_email = !empty($billing_data['email']) ? hash('sha256', sanitize_email($billing_data['email'])) : ''; 137 137 $billing_phone = !empty($billing_data['phone']) ? hash('sha256', sanitize_text_field($billing_data['phone'])) : ''; 138 $street_address = !empty($billing_data['street_address']) ? hash('sha256', sanitize_text_field($billing_data['street_address'])) : ''; 138 139 139 140 // IP Address Validation … … 163 164 'shipping_value' => floatval($order->get_shipping_total()), 164 165 'postal_code' => sanitize_text_field($order->get_billing_postcode()), 165 'street_address' => sanitize_text_field($order->get_billing_address_1()),166 'street_address' => $street_address, 166 167 'city' => sanitize_text_field($order->get_billing_city()), 167 168 'country' => sanitize_text_field($order->get_billing_country()), -
metrion/trunk/includes/initial.php
r3251175 r3288049 423 423 } 424 424 425 426 425 function metrion_update_identification_cookies(){ 427 426 $user_cookie_name = sanitize_key( get_option('metrion_user_cookie_name', 'mtrn_uid') ); … … 452 451 } 453 452 } 454 455 453 456 454 function metrion_initial_config() { … … 520 518 'microsoft_ads_enforce_consent_mode' => get_option('metrion_microsoft_ads_enforce_consent_mode', 0), 521 519 'microsoft_ads_enable_dynamic_remarketing' => get_option('metrion_microsoft_ads_enable_dynamic_remarketing', 0), 522 'microsoft_ads_tag_id' => get_option('metrion_microsoft_ads_tag_id', '') 520 'microsoft_ads_tag_id' => get_option('metrion_microsoft_ads_tag_id', ''), 521 'allow_pings' => get_option('metrion_allow_pre_consent_pings', 1), 522 'enable_detection' => get_option('metrion_enable_block_detection', 0) 523 523 ]); 524 524 … … 727 727 } 728 728 729 // Check if Metrion block detection is enabled 730 if(get_option('metrion_enable_block_detection', false)){ 731 // Check if Metrion detect script is not already fired before in user/session history 732 $detection_finished = isset($cookie_data['b']) 733 ? filter_var($cookie_data['b'], FILTER_VALIDATE_BOOLEAN) 734 : false; 735 736 // Only if detection is not finished, load the detection JS 737 if(!$detection_finished){ 738 $detect_scripts = []; 739 $detect_script_path = plugin_dir_path(__DIR__) . 'js/detect.js'; 740 $detect_script_version = file_exists($detect_script_path) ? filemtime($detect_script_path) : '1.0.0'; 741 if (file_exists($detect_script_path)) { 742 $detect_scripts['metrion-detect'] = plugins_url('js/detect.js', __DIR__) . '?ver=' . $detect_script_version; 743 } 744 // Enqueue detect script properly 745 foreach ($detect_scripts as $handle => $src) { 746 wp_enqueue_script($handle, esc_url($src), [], null, true); 747 } 748 } 749 } 750 729 751 // List of scripts to enqueue 730 752 $scripts = []; … … 771 793 } 772 794 } 795 796 797 // Register the Metrion Ping API route 798 add_action('rest_api_init', function () { 799 $namespace = get_option('metrion_api_path_part_1', 'metrion'); 800 $route = get_option('metrion_api_path_part_2', 'event') . '/ping'; 801 802 register_rest_route($namespace, '/' . $route, [ 803 'methods' => 'POST', 804 'callback' => 'handle_metrion_ping', 805 'permission_callback' => 'metrion_check_request_origin', 806 ]); 807 }); 808 809 /** 810 * Handles the Metrion Ping API request. 811 * 812 * @param WP_REST_Request $request 813 * @return array|WP_Error 814 */ 815 function handle_metrion_ping(WP_REST_Request $request) { 816 $body = json_decode($request->get_body(), true); 817 818 if (!is_array($body)) { 819 return new WP_Error('invalid_json', 'Invalid JSON body', ['status' => 400]); 820 } 821 822 $data = [ 823 'event' => isset($body['event']) ? sanitize_text_field($body['event']) : '', 824 'id' => isset($body['id']) ? sanitize_text_field($body['id']) : '', 825 'origin' => isset($body['origin']) ? esc_url_raw($body['origin']) : '', 826 'referrer' => isset($body['referrer']) ? esc_url_raw($body['referrer']) : '', 827 ]; 828 829 $ping_endpoint = 'https://stream.getmetrion.com/wp/ping/'; 830 831 $response = wp_remote_post($ping_endpoint, [ 832 'body' => wp_json_encode($data), 833 'headers' => ['Content-Type' => 'application/json'], 834 'timeout' => 20, 835 ]); 836 837 return is_wp_error($response) 838 ? new WP_Error('ping_failed', 'Failed to forward ping', ['status' => 500]) 839 : ['success' => true]; 840 } -
metrion/trunk/js/events.js
r3251175 r3288049 22 22 allow_cookie_placement_before_explicit_consent: metrion_api.allow_cookie_placement_before_explicit_consent, 23 23 click_ids_cookie_name: metrion_api.click_ids_cookie_name, 24 microsoft_ads_tag_id: metrion_api.microsoft_ads_tag_id 24 microsoft_ads_tag_id: metrion_api.microsoft_ads_tag_id, 25 allow_pings: metrion_api.allow_pings 25 26 }, 26 27 28 // The user manager object 27 29 user_manager: { 28 30 //Function to create the user cookie if not called by the PHP itself … … 47 49 }, 48 50 49 // The session manager object .51 // The session manager object 50 52 session_manager: { 51 53 session_cookie_exists: function () { … … 239 241 }, 1500); 240 242 }, 243 // Function that adds event listeners for the chosen CMP 241 244 add_consent_update_listener: function (cmp_update_trigger, context) { 242 245 window.metrion.helpers.log_debug(("Add listener for consent update: " + cmp_update_trigger + context.toString()), "log"); … … 258 261 }); 259 262 }, 260 263 // Initial consent check sequence 261 264 initial_consent_enforcement: function () { 262 265 // Start initial consent enforcement … … 265 268 // First check the initial Metrion consent cookie value (if available) 266 269 var metrion_consent_cookie = window.metrion.helpers.get_cookie_value(window.metrion.configuration.consent_cookie_name); 267 var initial_metrion_allow_marketing = false; 268 var cmp_allow_marketing = false; 270 271 // Set initial check variables related to consent and system detection 272 var initial_metrion_allow_marketing = false; // Metrion itself assumes marketing is not allowed by default 273 var cmp_allow_marketing = false; // Metrion assumes marketing is not allowed by default by the CMP 274 var blocking_detected = undefined; // No blocking detected by default 269 275 window.metrion.helpers.log_debug(("Initial consent enforcement cookie value: " + (metrion_consent_cookie || "null")), "log"); 270 276 271 // If the Metrion consent cookie is emtpy277 // If the Metrion consent cookie is NOT emtpy 272 278 if (metrion_consent_cookie !== null) { 273 279 window.metrion.helpers.log_debug("Consent cookie !== to null, so open floodgate.", "log"); … … 275 281 try{ 276 282 // If the value of the initial Metrion consent cookie is 1, then this indicates that here is no dynamic loading necessary 277 initial_metrion_allow_marketing = JSON.parse(decodeURIComponent(metrion_consent_cookie)).allow_marketing = "1"; 283 initial_metrion_allow_marketing = JSON.parse(decodeURIComponent(metrion_consent_cookie)).allow_marketing === "1"; 284 // If the blocking parameter is detected with a high probability (1), change the check variable to 1 else to 0 (because detection is completed) 285 if(JSON.parse(decodeURIComponent(metrion_consent_cookie)).b === "1"){ 286 blocking_detected = "1"; 287 } 288 else if(JSON.parse(decodeURIComponent(metrion_consent_cookie)).b === "0"){ 289 blocking_detected = "0"; 290 } 278 291 } 279 292 catch(parse_error){ … … 299 312 "allow_uid": Number(cookiebot_cookie.indexOf("necessary:true") > -1).toString(), 300 313 "allow_sid": Number(cookiebot_cookie.indexOf("necessary:true") > -1).toString(), 301 "unix": Date.now() 314 "b": blocking_detected, 315 "unix": Date.now() 302 316 })); 303 317 … … 348 362 "allow_uid": Number(cookieyes_object.necessary).toString(), 349 363 "allow_sid": Number(cookieyes_object.necessary).toString(), 364 "b": blocking_detected, 350 365 "unix": Date.now() 351 366 })); … … 390 405 "allow_uid": cmplz_functional, 391 406 "allow_sid": cmplz_functional, 407 "b": blocking_detected, 392 408 "unix": new Date().getTime() 393 409 }; … … 416 432 "allow_uid": Number(window.cmplz_has_consent("functional")).toString(), 417 433 "allow_sid": Number(window.cmplz_has_consent("functional")).toString(), 434 "b": blocking_detected, 418 435 "unix": Date.now() 419 436 })); … … 465 482 "allow_uid": allow_necessary, 466 483 "allow_sid": allow_necessary, 484 "b": blocking_detected, 467 485 "unix": Date.now() 468 486 })); … … 499 517 "allow_uid": allow_necessary, 500 518 "allow_sid": allow_necessary, 519 "b": blocking_detected, 501 520 "unix": Date.now() 502 521 })); … … 519 538 window.metrion.consent_manager.add_consent_update_listener("cf_consent", window); 520 539 } 540 // Default handling if no cmp is selected, fall back on regulars 541 else if (window.metrion.configuration.cmp_selection === "none") { 542 var encoded_value_based_on_cookiefirst = encodeURIComponent(JSON.stringify({ 543 "allow_marketing": metrion_api.allow_marketing, 544 "allow_pii": metrion_api.allow_pii, 545 "allow_uid": metrion_api.allow_uid, 546 "allow_sid": metrion_api.allow_sid, 547 "b": blocking_detected, 548 "unix": Date.now() 549 })); 550 window.metrion.helpers.set_cookie( 551 window.metrion.configuration.consent_cookie_name, 552 encoded_value_based_on_cookiefirst, 553 window.metrion.configuration.cookie_expiration_milliseconds, 554 "/", 555 window.metrion.configuration.cookie_domain 556 ); 557 window.metrion.configuration.floodgate_open = true; 558 window.metrion.configuration.cmp_update_handled = true; 559 cmp_allow_marketing = metrion_api.allow_marketing; 560 } 561 562 // Default handling if no cmp is selected, fall back on regulars 563 else if (window.metrion.configuration.cmp_selection === "custom") { 564 // Do nothing, the user should update the consent with the update_consent option 565 } 521 566 522 567 // Evaluate floodgate after … … 530 575 window.metrion.consent_manager.load_destination_js_dynamically(); 531 576 } 532 }, 577 578 return cmp_allow_marketing 579 }, 580 // Function to evaluate the floodgate status 533 581 evaluate_consent_floodgate: function () { 534 582 // First check if the floodgate is open … … 599 647 } 600 648 }, 601 602 649 // Function to manually overwrite the consent settings when no CMP is selected 603 650 update_consent: function (consent_object) { 604 651 var metrion_consent_cookie = window.metrion.helpers.get_cookie_value(window.metrion.configuration.consent_cookie_name); 605 652 if (metrion_consent_cookie !== null) { 606 653 current_consent_object = JSON.parse(decodeURIComponent(metrion_consent_cookie)); 654 var blocking_detected = "0"; // No blocking detected by default 655 if(JSON.parse(decodeURIComponent(metrion_consent_cookie)).b === "1"){ 656 blocking_detected = "1"; 657 } 607 658 updated_consent_object = consent_object; 659 // Add the blocking parameter 660 updated_consent_object.b = blocking_detected; 608 661 609 662 // Merge new consent values into the current consent object (the current is the one that needs updating) … … 623 676 ); 624 677 } 678 }, 679 680 // Check CMP consent status 681 has_explicit_cmp_consent: function(cmp){ 682 // Default value is false 683 var has_explicit_consent = false; 684 685 // Complianz 686 if(cmp === "cmplz"){ 687 var cmplz_banner_status = window.metrion.helpers.get_cookie_value("cmplz_banner-status"); 688 if (cmplz_banner_status !== null && cmplz_banner_status === "dismissed") { 689 has_explicit_consent = true; 690 } 691 else { 692 has_explicit_consent = false; 693 } 694 } 695 // Cookiebot 696 else if(cmp === "cookiebot"){ 697 has_explicit_consent = window.metrion.helpers.get_cookie_value("CookieConsent") !== null; 698 } 699 // OneTrust 700 else if(cmp === "onetrust"){ 701 has_explicit_consent = window.metrion.helpers.get_cookie_value("OptanonConsent") !== null; 702 } 703 else if(cmp === "cookieyes"){ 704 has_explicit_consent = window.metrion.helpers.get_cookie_value("cookieyes-consent") !== null; 705 } 706 else if(cmp === "cookiefirst"){ 707 has_explicit_consent = window.metrion.helpers.get_cookie_value("cookiefirst-consent") !== null; 708 709 } 710 711 return has_explicit_consent; 625 712 } 626 713 }, … … 744 831 }); 745 832 } 746 // Floodgate closed, store event behind floodgate 833 // Floodgate closed, store event behind floodgate and send ping 747 834 else { 835 if (metrion.configuration.allow_pings === "1"){ 836 //Trigger the ping 837 this.send_ping(event_name, event_data); 838 } 839 748 840 if (typeof localStorage !== "undefined" && window.metrion.configuration.allow_cookie_placement_before_explicit_consent === "1") { 749 841 //Append to floodgate array in localStorage which is persisstent across pages. … … 762 854 }, 763 855 856 // Send anonymous ping function 857 send_ping: function(event_name, event_body) { 858 var ping_url = metrion_api.api_url.replace(/\/?$/, '/') + "ping/"; 859 var origin = window.location.href; 860 var referrer = document.referrer; 861 862 // Use sendBeacon if available 863 if (navigator.sendBeacon) { 864 var payload = JSON.stringify({ 865 origin: origin, 866 referrer: referrer, 867 event: event_name, 868 id: event_body[metrion_api.event_id_name] 869 }); 870 871 navigator.sendBeacon(ping_url, payload); 872 } 873 }, 874 875 // JS session definition logic 764 876 session_event_logic: function () { 765 877 // Reload session exclusion … … 940 1052 } 941 1053 }, 1054 1055 // JS pageview event logic 942 1056 page_view_event_logic: function () { 943 1057 window.metrion.configuration.pageview_send = window.metrion.configuration.pageview_send || false; … … 949 1063 } 950 1064 }, 1065 // JS Woocommerce purchase logic 951 1066 woocommerce_purchase_logic: function (){ 952 1067 // jQuery is required for Woocommerce … … 978 1093 }); 979 1094 }, 1095 // JS Woocommerce other event logic 980 1096 woocommerce_event_logic: function () { 981 1097 // jQuery is required for Woocommerce … … 1176 1292 1177 1293 1178 // User cookie existance handling1294 // Initialization 1179 1295 (function () { 1296 // Check if the user id cookie exists 1180 1297 if (window.metrion.helpers.get_cookie_value(metrion_api.user_cookie_name + "_js") === null) { 1181 1298 // Only start this process if cookie and data placement is allowed … … 1186 1303 window.metrion.session_event_logic(); 1187 1304 window.metrion.page_view_event_logic(); 1305 window.metrion.woocommerce_purchase_logic() 1188 1306 // ALL CODE AFTER THIS IS ONLY FOR NON-CONVERSION ONLY TRACKING 1189 1307 if (window.metrion.configuration.purchase_only_tracking != "1") { 1190 1308 window.metrion.woocommerce_event_logic(); 1191 1309 } 1192 }) 1310 }); 1193 1311 } 1194 1312 else { 1195 // Trigger the logic, expecting them to get floodgated 1196 window.metrion.consent_manager.initial_consent_enforcement(); 1197 //window.metrion.consent_manager.evaluate_consent_floodgate(); 1198 window.metrion.session_event_logic(); 1199 window.metrion.page_view_event_logic(); 1200 window.metrion.woocommerce_purchase_logic() 1201 // ALL CODE AFTER THIS IS ONLY FOR NON-CONVERSION ONLY TRACKING 1202 if (window.metrion.configuration.purchase_only_tracking != "1") { 1203 window.metrion.woocommerce_event_logic(); 1313 // Check if consent is already provided, but only Metrion is not initialized properly yet 1314 var has_explicit_cmp_consent = window.metrion.consent_manager.has_explicit_cmp_consent(window.metrion.configuration.cmp_selection); 1315 if(has_explicit_cmp_consent){ 1316 window.metrion.user_manager.ensure_user_cookie_existance(function () { 1317 window.metrion.consent_manager.initial_consent_enforcement(); 1318 window.metrion.session_event_logic(); 1319 window.metrion.page_view_event_logic(); 1320 window.metrion.woocommerce_purchase_logic() 1321 // ALL CODE AFTER THIS IS ONLY FOR NON-CONVERSION ONLY TRACKING 1322 if (window.metrion.configuration.purchase_only_tracking != "1") { 1323 window.metrion.woocommerce_event_logic(); 1324 } 1325 }); 1326 } 1327 // Metrion is not initialized yet, there is no user id and no permission for placement before consent. There is also no explicit consent found for the CMP yet. Floodgate everything 1328 else{ 1329 window.metrion.consent_manager.initial_consent_enforcement(); 1330 window.metrion.session_event_logic(); 1331 window.metrion.page_view_event_logic(); 1332 window.metrion.woocommerce_purchase_logic() 1333 // ALL CODE AFTER THIS IS ONLY FOR NON-CONVERSION ONLY TRACKING 1334 if (window.metrion.configuration.purchase_only_tracking != "1") { 1335 window.metrion.woocommerce_event_logic(); 1336 } 1204 1337 } 1205 1338 } -
metrion/trunk/js/google_ads/events.js
r3251175 r3288049 37 37 } 38 38 39 // Check if gtag exist 39 40 if(gtag_script_loaded === false || typeof window.gtag === "undefined"){ 40 41 // Dynamically and Async loading of gtag script … … 58 59 start_google_ads_event_handling(); 59 60 } 60 61 62 61 } 63 62 }; … … 116 115 // Check if Metrion API and gtag are available before sending events 117 116 if(window.metrion_api && window.metrion && typeof window.gtag != "undefined"){ 118 119 // Google Ads dynamic remarketing item view event 120 if(event_name === "item_view"){ 121 window.gtag('event', 'view_item',{ 122 'send_to': window.metrion_api.google_ads_tag_id, 123 'value': event_data.event_body.items[0].price, 124 'currency': event_data.event_body.items[0].currency, 125 'items': [{ 126 'id': event_data.event_body.items[0].id, 127 'google_business_vertical': 'retail' 128 }] 129 }); 130 131 } 132 133 // Google Ads dynamic remarketing add to cart event 134 if(event_name === "add_to_cart"){ 135 window.gtag('event', 'add_to_cart',{ 136 'send_to': window.metrion_api.google_ads_tag_id, 137 'value': event_data.event_body.items[0].price, 138 'currency': event_data.event_body.items[0].currency, 139 'items': [{ 140 'id': event_data.event_body.items[0].id, 141 'google_business_vertical': 'retail' 142 }] 143 }); 144 145 } 146 147 // Google Ads dynamic remarketing view item list event 148 if(event_name === "view_item_list"){ 149 var google_ads_items = []; 150 var collective_value = 0; 151 var collective_currency = "EUR"; 152 153 // Loop through all items to get the collective parameters necessary for Google Ads dynamic remarketing 154 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 155 collective_currency = event_data.event_body.items[0].currency; 117 118 // DYNAMIC REMARKETING 119 // Check if dynamic remarketing is enabled if that is the case, send the remarketing tag 120 if(window.metrion_api.google_ads_enable_dynamic_remarketing === "1"){ 121 122 // Google Ads dynamic remarketing item view event 123 if(event_name === "item_view"){ 124 window.gtag('event', 'view_item',{ 125 'send_to': window.metrion_api.google_ads_tag_id, 126 'value': event_data.event_body.items[0].price, 127 'currency': event_data.event_body.items[0].currency, 128 'items': [{ 129 'id': event_data.event_body.items[0].id, 130 'google_business_vertical': 'retail' 131 }] 132 }); 133 134 } 135 136 // Google Ads dynamic remarketing add to cart event 137 if(event_name === "add_to_cart"){ 138 window.gtag('event', 'add_to_cart',{ 139 'send_to': window.metrion_api.google_ads_tag_id, 140 'value': event_data.event_body.items[0].price, 141 'currency': event_data.event_body.items[0].currency, 142 'items': [{ 143 'id': event_data.event_body.items[0].id, 144 'google_business_vertical': 'retail' 145 }] 146 }); 147 148 } 149 150 // Google Ads dynamic remarketing view item list event 151 if(event_name === "view_item_list"){ 152 var google_ads_items = []; 153 var collective_value = 0; 154 var collective_currency = "EUR"; 155 156 // Loop through all items to get the collective parameters necessary for Google Ads dynamic remarketing 157 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 158 collective_currency = event_data.event_body.items[0].currency; 159 for(google_ads_item_i = 0; google_ads_item_i < event_data.event_body.items.length; google_ads_item_i ++ ){ 160 google_ads_items.push({ 161 id: event_data.event_body.items[google_ads_item_i].id, 162 'google_business_vertical': 'retail' 163 }); 164 collective_value = parseFloat(collective_value) + (parseFloat(event_data.event_body.items[google_ads_item_i].price) * parseInt(event_data.event_body.items[google_ads_item_i].quantity)); 165 } 166 } 167 // Send remarketing event 168 window.gtag('event', 'view_item_list',{ 169 'send_to': window.metrion_api.google_ads_tag_id, 170 'value': collective_value, 171 'currency': collective_currency, 172 'items': google_ads_items 173 }); 174 } 175 176 // Google Ads dynamic remarketing view search results event 177 if(event_name === "view_search_results"){ 178 var google_ads_items = []; 179 var collective_value = 0; 180 var collective_currency = "EUR"; 181 182 // Loop through all items to get the collective parameters necessary for Google Ads dynamic remarketing 183 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 184 collective_currency = event_data.event_body.items[0].currency; 185 for(google_ads_item_i = 0; google_ads_item_i < event_data.event_body.items.length; google_ads_item_i ++ ){ 186 google_ads_items.push({ 187 id: event_data.event_body.items[google_ads_item_i].id, 188 'google_business_vertical': 'retail' 189 }); 190 collective_value = parseFloat(collective_value) + (parseFloat(event_data.event_body.items[google_ads_item_i].price) * parseInt(event_data.event_body.items[google_ads_item_i].quantity)); 191 } 192 } 193 // Send remarketing event 194 window.gtag('event', 'view_search_results',{ 195 'send_to': window.metrion_api.google_ads_tag_id, 196 'value': collective_value, 197 'currency': collective_currency, 198 'items': google_ads_items 199 }); 200 } 201 202 // Google Ads dynamic remarketing add to cart event 203 if(event_name === "begin_checkout"){ 204 var google_ads_items = []; 205 var collective_value = 0; 206 // Loop through all items to get the collective parameters necessary for Google Ads dynamic remarketing 156 207 for(google_ads_item_i = 0; google_ads_item_i < event_data.event_body.items.length; google_ads_item_i ++ ){ 157 208 google_ads_items.push({ 158 209 id: event_data.event_body.items[google_ads_item_i].id, 159 'google_business_vertical': 'retail'210 'google_business_vertical': 'retail' 160 211 }); 161 212 collective_value = parseFloat(collective_value) + (parseFloat(event_data.event_body.items[google_ads_item_i].price) * parseInt(event_data.event_body.items[google_ads_item_i].quantity)); 162 213 } 163 } 164 // Send remarketing event 165 window.gtag('event', 'view_item_list',{ 166 'send_to': window.metrion_api.google_ads_tag_id, 167 'value': collective_value, 168 'currency': collective_currency, 169 'items': google_ads_items 170 }); 171 } 172 173 // Google Ads dynamic remarketing view search results event 174 if(event_name === "view_search_results"){ 175 var google_ads_items = []; 176 var collective_value = 0; 177 var collective_currency = "EUR"; 178 179 // Loop through all items to get the collective parameters necessary for Google Ads dynamic remarketing 180 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 181 collective_currency = event_data.event_body.items[0].currency; 214 // Send remarketing event 215 window.gtag('event', 'begin_checkout',{ 216 'send_to': window.metrion_api.google_ads_tag_id, 217 'value': collective_value, 218 'currency': event_data.event_body.items[0].currency, 219 'items': google_ads_items 220 }); 221 222 } 223 // Process purchase events 224 if(event_name === "purchase"){ 225 // Loop through all items to get the collective parameters necessary for Google Ads dynamic remarketing 226 var google_ads_items = []; 182 227 for(google_ads_item_i = 0; google_ads_item_i < event_data.event_body.items.length; google_ads_item_i ++ ){ 183 228 google_ads_items.push({ 184 229 id: event_data.event_body.items[google_ads_item_i].id, 185 'google_business_vertical': 'retail'230 'google_business_vertical': 'retail' 186 231 }); 187 232 collective_value = parseFloat(collective_value) + (parseFloat(event_data.event_body.items[google_ads_item_i].price) * parseInt(event_data.event_body.items[google_ads_item_i].quantity)); 188 233 } 189 } 190 // Send remarketing event 191 window.gtag('event', 'view_search_results',{ 192 'send_to': window.metrion_api.google_ads_tag_id, 193 'value': collective_value, 194 'currency': collective_currency, 195 'items': google_ads_items 196 }); 197 } 198 199 // Google Ads dynamic remarketing add to cart event 200 if(event_name === "begin_checkout"){ 201 var google_ads_items = []; 202 var collective_value = 0; 203 // Loop through all items to get the collective parameters necessary for Google Ads dynamic remarketing 204 for(google_ads_item_i = 0; google_ads_item_i < event_data.event_body.items.length; google_ads_item_i ++ ){ 205 google_ads_items.push({ 206 id: event_data.event_body.items[google_ads_item_i].id, 207 'google_business_vertical': 'retail' 208 }); 209 collective_value = parseFloat(collective_value) + (parseFloat(event_data.event_body.items[google_ads_item_i].price) * parseInt(event_data.event_body.items[google_ads_item_i].quantity)); 210 } 211 // Send remarketing event 212 window.gtag('event', 'begin_checkout',{ 213 'send_to': window.metrion_api.google_ads_tag_id, 214 'value': collective_value, 215 'currency': event_data.event_body.items[0].currency, 216 'items': google_ads_items 217 }); 218 219 } 220 234 // Send remarketing event to Google Ads 235 window.gtag('event', 'purchase', { 236 'send_to': window.metrion_api.google_ads_tag_id, 237 'value': event_data.event_body.order_total, 238 'currency': event_data.event_body.currency, 239 'transaction_id': event_data.event_body.order_id, 240 'items': google_ads_items 241 }); 242 } 243 } 244 245 // ENHANCED PURCHASE 221 246 // Process purchase events 222 247 if(event_name === "purchase"){ 223 var google_ads_items = [];224 248 // Send conversion event to Google Ads 225 249 window.gtag('event', 'conversion', { … … 230 254 }); 231 255 232 // Send enhanced conversion event for deduplication256 // GOOGLE ADS CONTEXT CHECKS 233 257 // First Check if recent relevant click-ids are stored 234 var metrion_click_ids = JSON.parse(decodeURIComponent(window.metrion.helpers.get_cookie_value("mtrn_cids"))); 235 var google_ads_click_id = ""; 236 if(metrion_click_ids !== null && typeof metrion_click_ids.gclid !== "undefined"){ 237 google_ads_click_id = metrion_click_ids.gclid; 238 } 239 240 // Send enhanced conversion event for deduplication 258 var google_ads_click_id = undefined; 259 260 try{ 261 //Parse the cookie if it exists 262 var parsed_click_ids = JSON.parse(decodeURIComponent(window.metrion.helpers.get_cookie_value(window.metrion_api.click_ids_cookie_name))); 263 if(parsed_click_ids !== null && typeof parsed_click_ids.gclid !== "undefined"){ 264 google_ads_click_id = parsed_click_ids.gclid; 265 } 266 }catch(e){}; 267 268 // If block dectection is not enabled set the value to undefined to remove the variable from the conversion 269 var block_detected = "0"; 270 if(typeof event_data.consent.b !== "undefined" && event_data.consent.b === "1"){ 271 block_detected = "1"; 272 } 273 274 // Allways send enhanced conversion event for deduplication 275 // If this event does not exist, this gtag script has failed. 276 // If this event contains a blocking intent (1), don't deduplicate for untagged conversions 241 277 window.metrion.helpers.log_debug("Google Ads conversion send through gtag", 'log'); 242 278 window.metrion.send_event("google_ads_gtag_purchase_triggered", { … … 245 281 'currency': event_data.event_body.currency, 246 282 'transaction_id': event_data.event_body.order_id, 247 'gclid': google_ads_click_id 283 'gclid': google_ads_click_id, 284 'enable_detection': window.metrion_api.enable_detection, 285 'b': block_detected, 286 'trigger_type': "front-end" 248 287 }, {}); 249 250 251 // Check if dynamic remarketing is enabled if that is the case, send the remarketing tag 252 if(window.metrion_api.google_ads_enable_dynamic_remarketing === "1"){ 253 // Loop through all items to get the collective parameters necessary for Google Ads dynamic remarketing 254 for(google_ads_item_i = 0; google_ads_item_i < event_data.event_body.items.length; google_ads_item_i ++ ){ 255 google_ads_items.push({ 256 id: event_data.event_body.items[google_ads_item_i].id, 257 'google_business_vertical': 'retail' 258 }); 259 collective_value = parseFloat(collective_value) + (parseFloat(event_data.event_body.items[google_ads_item_i].price) * parseInt(event_data.event_body.items[google_ads_item_i].quantity)); 260 } 261 262 // Send remarketing event to Google Ads 263 window.gtag('event', 'purchase', { 264 'send_to': window.metrion_api.google_ads_tag_id, 265 'value': event_data.event_body.order_total, 266 'currency': event_data.event_body.currency, 267 'transaction_id': event_data.event_body.order_id, 268 'items': google_ads_items 269 }); 270 } 271 } 288 } 272 289 } 273 290 }; -
metrion/trunk/js/meta/events.js
r3251175 r3288049 177 177 var collective_value = 0; 178 178 var collective_currency = event_data.event_body.items[0].currency; // Get from the first item 179 179 180 // Loop through all items to get the collective parameters necessary for Meta 180 181 for(meta_item_i = 0; meta_item_i < event_data.event_body.items.length; meta_item_i ++ ){ … … 187 188 collective_value = parseFloat(collective_value) + (parseFloat(event_data.event_body.items[meta_item_i].price) * parseInt(event_data.event_body.items[meta_item_i].quantity)); 188 189 } 190 191 // Trigger the conversion 189 192 window.fbq('trackSingle', window.metrion_api.meta_pixel_id, "Purchase", { 190 193 eventID: event_data[window.metrion_api.event_id_name], -
metrion/trunk/js/microsoft_ads/events.js
r3251175 r3288049 117 117 window.uetq = window.uetq || []; 118 118 119 // Microsoft home page view 120 if(event_name === "page_view" && event_data.location.path === "/"){ 121 window.uetq.push('event', '', { 122 'ecomm_pagetype': 'home' 123 }); 124 } 125 126 // Microsoft product detail view 127 if(event_name === "item_view"){ 128 if(typeof event_data.event_body.items !== 'undefined' && Array.isArray(event_data.event_body.items) && event_data.event_body.items.length > 0){ 129 window.uetq.push('event', '', { 130 'ecomm_prodid': [event_data.event_body.items[0].id], 131 'ecomm_pagetype': 'product' 132 }); 133 } 134 } 135 // Microsoft Ads dynamic remarketing view item list event 136 if(event_name === "view_item_list"){ 137 var microsoft_ads_items = []; 138 // Loop through all items to get the collective parameters necessary for Microsoft Ads dynamic remarketing 139 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 140 collective_currency = event_data.event_body.items[0].currency; 141 for(microsoft_ads_item_i = 0; microsoft_ads_item_i < event_data.event_body.items.length; microsoft_ads_item_i ++ ){ 142 microsoft_ads_items.push(event_data.event_body.items[microsoft_ads_item_i].id); 143 } 144 } 145 window.uetq.push('event', '', { 146 'ecomm_prodid': microsoft_ads_items, 147 'ecomm_pagetype': 'category' 148 }); 149 } 150 151 // Microsoft Ads dynamic remarketing view search item list event 152 if(event_name === "view_search_results"){ 153 var microsoft_ads_items = []; 154 // Loop through all items to get the collective parameters necessary for Microsoft Ads dynamic remarketing 155 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 156 collective_currency = event_data.event_body.items[0].currency; 157 for(microsoft_ads_item_i = 0; microsoft_ads_item_i < event_data.event_body.items.length; microsoft_ads_item_i ++ ){ 158 microsoft_ads_items.push(event_data.event_body.items[microsoft_ads_item_i].id); 159 } 160 } 161 window.uetq.push('event', '', { 162 'ecomm_prodid': microsoft_ads_items, 163 'ecomm_pagetype': 'searchresults' 164 }); 165 } 166 167 // Microsoft Ads dynamic remarketing cart view event 168 if(event_name === "basket_view"){ 169 var microsoft_ads_items = []; 170 // Loop through all items to get the collective parameters necessary for Microsoft Ads dynamic remarketing 171 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 172 collective_currency = event_data.event_body.items[0].currency; 173 for(microsoft_ads_item_i = 0; microsoft_ads_item_i < event_data.event_body.items.length; microsoft_ads_item_i ++ ){ 174 microsoft_ads_items.push(event_data.event_body.items[microsoft_ads_item_i].id); 175 } 176 } 177 window.uetq.push('event', '', { 178 'ecomm_prodid': microsoft_ads_items, 179 'ecomm_pagetype': 'cart' 180 }); 119 // DYNAMIC REMARKETING 120 // Check if dynamic remarketing is enabled if that is the case, send the remarketing tag 121 if(window.metrion_api.microsoft_ads_enable_dynamic_remarketing === "1"){ 122 // Microsoft home page view 123 if(event_name === "page_view" && event_data.location.path === "/"){ 124 window.uetq.push('event', '', { 125 'ecomm_pagetype': 'home' 126 }); 127 } 128 129 // Microsoft product detail view 130 if(event_name === "item_view"){ 131 if(typeof event_data.event_body.items !== 'undefined' && Array.isArray(event_data.event_body.items) && event_data.event_body.items.length > 0){ 132 window.uetq.push('event', '', { 133 'ecomm_prodid': [event_data.event_body.items[0].id], 134 'ecomm_pagetype': 'product' 135 }); 136 } 137 } 138 // Microsoft Ads dynamic remarketing view item list event 139 if(event_name === "view_item_list"){ 140 var microsoft_ads_items = []; 141 // Loop through all items to get the collective parameters necessary for Microsoft Ads dynamic remarketing 142 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 143 collective_currency = event_data.event_body.items[0].currency; 144 for(microsoft_ads_item_i = 0; microsoft_ads_item_i < event_data.event_body.items.length; microsoft_ads_item_i ++ ){ 145 microsoft_ads_items.push(event_data.event_body.items[microsoft_ads_item_i].id); 146 } 147 } 148 window.uetq.push('event', '', { 149 'ecomm_prodid': microsoft_ads_items, 150 'ecomm_pagetype': 'category' 151 }); 152 } 153 154 // Microsoft Ads dynamic remarketing view search item list event 155 if(event_name === "view_search_results"){ 156 var microsoft_ads_items = []; 157 // Loop through all items to get the collective parameters necessary for Microsoft Ads dynamic remarketing 158 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 159 collective_currency = event_data.event_body.items[0].currency; 160 for(microsoft_ads_item_i = 0; microsoft_ads_item_i < event_data.event_body.items.length; microsoft_ads_item_i ++ ){ 161 microsoft_ads_items.push(event_data.event_body.items[microsoft_ads_item_i].id); 162 } 163 } 164 window.uetq.push('event', '', { 165 'ecomm_prodid': microsoft_ads_items, 166 'ecomm_pagetype': 'searchresults' 167 }); 168 } 169 170 // Microsoft Ads dynamic remarketing cart view event 171 if(event_name === "basket_view"){ 172 var microsoft_ads_items = []; 173 // Loop through all items to get the collective parameters necessary for Microsoft Ads dynamic remarketing 174 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 175 collective_currency = event_data.event_body.items[0].currency; 176 for(microsoft_ads_item_i = 0; microsoft_ads_item_i < event_data.event_body.items.length; microsoft_ads_item_i ++ ){ 177 microsoft_ads_items.push(event_data.event_body.items[microsoft_ads_item_i].id); 178 } 179 } 180 window.uetq.push('event', '', { 181 'ecomm_prodid': microsoft_ads_items, 182 'ecomm_pagetype': 'cart' 183 }); 184 } 185 186 // Microsoft Ads dynamic remarketing purchase event 187 if(event_name === "purchase"){ 188 var microsoft_ads_items = []; 189 // Loop through all items to get the collective parameters necessary for Microsoft Ads dynamic remarketing 190 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){ 191 collective_currency = event_data.event_body.items[0].currency; 192 for(microsoft_ads_item_i = 0; microsoft_ads_item_i < event_data.event_body.items.length; microsoft_ads_item_i ++ ){ 193 microsoft_ads_items.push(event_data.event_body.items[microsoft_ads_item_i].id); 194 } 195 } 196 // Dynamic remarketing event for 197 window.uetq.push('event', '', { 198 'ecomm_prodid': microsoft_ads_items, 199 'ecomm_pagetype': 'purchase' 200 }); 201 } 181 202 } 182 203 … … 194 215 // Send enhanced conversion event for deduplication 195 216 // First Check if recent relevant click-ids are stored 196 var metrion_click_ids = JSON.parse(decodeURIComponent(window.metrion.helpers.get_cookie_value("mtrn_cids"))); 197 var microsoft_ads_click_id = ""; 198 if(metrion_click_ids !== null && typeof metrion_click_ids.msclkid !== "undefined"){ 199 microsoft_ads_click_id = metrion_click_ids.msclkid; 200 } 217 var microsoft_ads_click_id = undefined; 218 try{ 219 //Parse the cookie if it exists 220 var parsed_click_ids = JSON.parse(decodeURIComponent(window.metrion.helpers.get_cookie_value(window.metrion_api.click_ids_cookie_name))); 221 if(parsed_click_ids !== null && typeof parsed_click_ids.gclid !== "undefined"){ 222 microsoft_ads_click_id = parsed_click_ids.msclkid; 223 } 224 }catch(e){}; 225 226 // If block detection is enabled, use the probability parameter to verify 227 var block_detected = "0"; 228 if(typeof event_data.consent.b !== "undefined" && event_data.consent.b === "1"){ 229 block_detected = "1"; 230 } 231 201 232 // Send the event and add the relevant identifier 202 233 window.metrion.helpers.log_debug("Microsoft Ads conversion send through uetq", 'log'); … … 205 236 "currency": event_data.event_body.currency, 206 237 "transaction_id": event_data.event_body.order_id, 207 "msclkid": microsoft_ads_click_id 238 "msclkid": microsoft_ads_click_id, 239 "enable_detection": window.metrion_api.enable_detection, 240 "b": block_detected, 241 "trigger_type": "front-end" 208 242 }, {}); 209 210 // Additionally, add the dynamic remarketing event if enabled211 if(window.metrion_api.microsoft_ads_enable_dynamic_remarketing === "1"){212 var microsoft_ads_items = [];213 // Loop through all items to get the collective parameters necessary for Microsoft Ads dynamic remarketing214 if(typeof event_data.event_body.items !== "undefined" && event_data.event_body.items.length > 0){215 collective_currency = event_data.event_body.items[0].currency;216 for(microsoft_ads_item_i = 0; microsoft_ads_item_i < event_data.event_body.items.length; microsoft_ads_item_i ++ ){217 microsoft_ads_items.push(event_data.event_body.items[microsoft_ads_item_i].id);218 }219 }220 // Dynamic remarketing event for221 window.uetq.push('event', '', {222 'ecomm_prodid': microsoft_ads_items,223 'ecomm_pagetype': 'purchase'224 });225 }226 243 } 227 244 }; -
metrion/trunk/readme.txt
r3251175 r3288049 3 3 Tags: tracking, pixel, ecommerce tracking, google ads, meta ads 4 4 Requires at least: 3.8 5 Tested up to: 6. 76 Stable tag: 1. 0.05 Tested up to: 6.8 6 Stable tag: 1.1.0 7 7 Requires PHP: 7.1 8 8 License: GPLv3 or later … … 15 15 16 16 Metrion natively tracks key ecommerce and lead interactions directly from Wordpress and it's most used ecommerce-plugin; Woo (Woocommerce). 17 Native tracking entails that data is collected by listening to the build-in triggers of Wordpress and Woo instead of building layers of 'technical trackings cosmetics' on-top-off its foundations, making tracki gnunnecessarily complex and error-prone.17 Native tracking entails that data is collected by listening to the build-in triggers of Wordpress and Woo instead of building layers of 'technical trackings cosmetics' on-top-off its foundations, making tracking unnecessarily complex and error-prone. 18 18 By directly integrating into Wordpress you can skip expensive implementation costs and guarantee the highest level of data accuracy for growing your business. 19 19 20 20 = Full Metrion Feature List = 21 * First party & server-side tracking (through webhooks)22 * Advanced ad- & trackblocking preventions21 * First party & server-side tracking 22 * Advanced track-blocking detection 23 23 * Consent Management Platform integrations 24 24 * No data storage in cookies/browser storage before explicit consent (optional setting) … … 28 28 * Google Ads conversion tracking 29 29 * Google Ads enhanced conversion tracking (Through Google Ads API) 30 * Google Ads enhanced lead tracking 30 31 * Google consent mode V2 (optional) 31 32 * Google dynamic remarketing tracking for retail vertical … … 37 38 * Microsoft Ads consent mode 38 39 * Microsoft Ads dynamic remarketing list functionality 40 * Pre-consent event counting 39 41 40 42 == Installation == … … 52 54 - Visit 53 55 - Page view 56 - Product view 57 - Product list view 58 - Search result list view 54 59 - Add to cart 55 - cart view56 - checkout start57 - purchase60 - Cart view 61 - Checkout start 62 - Purchase 58 63 When a user is identified with data like an email address, phone number, this data can be included with each interaction based on the consent configurations within Metrion. 59 64 This data is temporarily stored for conversion attribution purposes. Read more about our [terms of use](https://getmetrion.com/en/terms-and-conditions) and [privacy policy](https://getmetrion.com/en/privacy-policy). 60 65 61 66 = Google Ads Tracking = 62 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 Metrion's user interactionscan be shared with Google Ads.67 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. 63 68 64 69 Read more about our [terms of use](https://support.google.com/adspolicy/answer/54818?hl=en) and [privacy policy](https://policies.google.com/privacy). 65 70 66 71 = Meta Ads Tracking = 67 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 Metrion's user interactionscan be shared with Meta Ads.72 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. 68 73 69 74 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/). 70 75 71 76 = Microsoft Ads Tracking = 72 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 Metrion's user interactions can be shared with MetaAds.77 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. 73 78 74 79 Read more about our [terms of use](https://www.microsoft.com/en/servicesagreement) and [privacy policy](https://www.microsoft.com/en-us/privacy/privacystatement). … … 81 86 82 87 == Changelog == 88 89 90 = 1.1.0 = 91 - Added support for pre-consent pings for compliant event counting 92 - Improved track blocking detection and integration with marketing trackers 83 93 84 94 = 1.0.0 = -
metrion/trunk/uninstall.php
r3251175 r3288049 43 43 'metrion_microsoft_ads_enforce_consent_mode', 44 44 'metrion_microsoft_ads_enable_dynamic_remarketing', 45 'metrion_microsoft_ads_tag_id' 45 'metrion_microsoft_ads_tag_id', 46 'metrion_allow_pre_consent_pings', 47 'metrion_enable_block_detection' 46 48 ]; 47 49 -
metrion/trunk/views/settings.php
r3251175 r3288049 6 6 <div> 7 7 <h2>Metrion Settings</h2> 8 <p>Version: 1.0.0 (Beta)</p> 9 <p>Please provide the required Google Ads account ID for enabling the conversion sync.</p> 8 <p>Version: 1.2.0 </p> 10 9 <form method="post" action="options.php"> 11 10 <?php settings_fields('metrion_options_group'); ?> … … 131 130 <select id="metrion_cmp_selection" name="metrion_cmp_selection"> 132 131 <option value="none" <?php selected(get_option('metrion_cmp_selection', 'none'), 'none'); ?>>No CMP</option> 132 <option value="custom" <?php selected(get_option('metrion_cmp_selection', 'none'), 'custom'); ?>>Custom CMP</option> 133 133 <option value="cookiebot" <?php selected(get_option('metrion_cmp_selection', 'none'), 'cookiebot'); ?>>CookieBot</option> 134 134 <option value="cookieyes" <?php selected(get_option('metrion_cmp_selection', 'none'), 'cookieyes'); ?>>CookieYes</option> … … 196 196 </td> 197 197 </tr> 198 <!-- Pings settings - don't show for now --> 199 <!--<tr valign="top"> 200 <th scope="row"> 201 <label for="metrion_allow_pre_consent_pings"> 202 Allow pre-consent pings to get insight into missing data due to lack of consent. 203 </label></th> 204 <td> 205 <label class="switch"> 206 <input readonly type="checkbox" id="metrion_allow_pre_consent_pings" name="metrion_allow_pre_consent_pings" value="1" <?php checked(1, get_option('metrion_allow_pre_consent_pings', 0)); ?>> 207 <span class="slider round"></span> 208 </label> 209 </td> 210 </tr>--> 211 <tr valign="top"> 212 <th scope="row"> 213 <label for="metrion_enable_block_detection"> 214 Enable block detection. 215 </label></th> 216 <td> 217 <label class="switch"> 218 <input type="checkbox" id="metrion_enable_block_detection" name="metrion_enable_block_detection" value="1" <?php checked(1, get_option('metrion_enable_block_detection', 0)); ?>> 219 <span class="slider round"></span> 220 </label> 221 </td> 222 </tr> 198 223 </table> 199 224 <!-- Google Ads settings --> … … 211 236 </tr> 212 237 <tr valign="top"> 238 <th scope="row"><label for="metrion_enforce_google_consent_mode">Enforce Google Consent mode through Metrion. Please make sure you don't have conflicting implementations of consent (e.g. through your CMP)</label></th> 239 <td> 240 <label class="switch"> 241 <input type="checkbox" id="metrion_enforce_google_consent_mode" name="metrion_enforce_google_consent_mode" value="1" <?php checked(1, get_option('metrion_enforce_google_consent_mode', 0)); ?>> 242 <span class="slider round"></span> 243 </label> 244 </td> 245 </tr> 246 <tr valign="top"> 213 247 <th scope="row"><label for="metrion_google_ads_account_id">Google Ads Account ID</label></th> 214 248 <td><input type="text" id="metrion_google_ads_account_id" name="metrion_google_ads_account_id" placeholder="AW-XXXXXXX" value="<?php echo esc_attr(get_option('metrion_google_ads_account_id', '')); ?>" /></td> … … 237 271 </td> 238 272 </tr> 239 <tr valign="top"> 240 <th scope="row"><label for="metrion_enforce_google_consent_mode">Enforce Google Consent mode through Metrion. Please make sure you don't have conflicting implementations of consent (e.g. through your CMP)</label></th> 241 <td> 242 <label class="switch"> 243 <input type="checkbox" id="metrion_enforce_google_consent_mode" name="metrion_enforce_google_consent_mode" value="1" <?php checked(1, get_option('metrion_enforce_google_consent_mode', 0)); ?>> 244 <span class="slider round"></span> 245 </label> 246 </td> 247 </tr> 273 248 274 <tr valign="top"> 249 275 <th scope="row"><label for="metrion_enable_google_ads_dynamic_remarketing">Enable Google Dynamic Remarketing. Requires the Google tag ID to be filled in. Please make sure you don't have conflicting implementations remarketing (e.g. through GTM or other plugins)</label></th>
Note: See TracChangeset
for help on using the changeset viewer.