Plugin Directory

Changeset 3288049


Ignore:
Timestamp:
05/05/2025 07:40:55 PM (10 months ago)
Author:
metriondev
Message:

Version 1.1.0

Location:
metrion/trunk
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • metrion/trunk/core.php

    r3251175 r3288049  
    33* Plugin Name:          Metrion
    44* Description:          Skip manual implementation, sync data directly tailored to destinations like Google Ads and Meta Ads.
    5 * Version:              1.0.0
     5* Version:              1.1.0
    66* Author:               Metrion
    77* Author URI:           https://getmetrion.com
     
    3131    add_option('metrion_click_ids_cookie_name', 'mtrn_cids');                               // Default click IDs cookie name
    3232    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
    3335   
    3436    // Consent management settings
     
    6769    register_setting('metrion_options_group', 'metrion_customer_api_key', ['sanitize_callback' => 'sanitize_text_field']);
    6870
    69 
    7071    register_setting('metrion_options_group', 'metrion_webhook_destination', ['sanitize_callback' => 'esc_url_raw']);
    7172    register_setting('metrion_options_group', 'metrion_api_path_part_1', ['sanitize_callback' => 'sanitize_text_field']);
     
    8384    register_setting('metrion_options_group', 'metrion_click_ids_cookie_name', ['sanitize_callback' => 'sanitize_key']);
    8485    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']);
    8589
    8690    // Register the consent management settings
     
    150154   
    151155        // 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';
    153157   
    154158        // Enqueue admin script
  • metrion/trunk/includes/event_capture.php

    r3251175 r3288049  
    136136    $billing_email      = !empty($billing_data['email']) ? hash('sha256', sanitize_email($billing_data['email'])) : '';
    137137    $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'])) : '';
    138139
    139140    // IP Address Validation
     
    163164        'shipping_value'            => floatval($order->get_shipping_total()),
    164165        '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,
    166167        'city'                      => sanitize_text_field($order->get_billing_city()),
    167168        'country'                   => sanitize_text_field($order->get_billing_country()),
  • metrion/trunk/includes/initial.php

    r3251175 r3288049  
    423423}
    424424
    425 
    426425function metrion_update_identification_cookies(){
    427426    $user_cookie_name = sanitize_key( get_option('metrion_user_cookie_name', 'mtrn_uid') );
     
    452451    }
    453452}
    454 
    455453
    456454function metrion_initial_config() {
     
    520518        'microsoft_ads_enforce_consent_mode' => get_option('metrion_microsoft_ads_enforce_consent_mode', 0),
    521519        '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)
    523523    ]);
    524524
     
    727727    }
    728728
     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
    729751    // List of scripts to enqueue
    730752    $scripts = [];
     
    771793    }
    772794}
     795
     796
     797// Register the Metrion Ping API route
     798add_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 */
     815function 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  
    2222        allow_cookie_placement_before_explicit_consent: metrion_api.allow_cookie_placement_before_explicit_consent,
    2323        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
    2526    },
    2627
     28    // The user manager object
    2729    user_manager: {
    2830        //Function to create the user cookie if not called by the PHP itself
     
    4749    },
    4850
    49     // The session manager object.
     51    // The session manager object
    5052    session_manager: {
    5153        session_cookie_exists: function () {
     
    239241            }, 1500);
    240242        },
     243        // Function that adds event listeners for the chosen CMP
    241244        add_consent_update_listener: function (cmp_update_trigger, context) {
    242245            window.metrion.helpers.log_debug(("Add listener for consent update: " + cmp_update_trigger + context.toString()), "log");
     
    258261            });
    259262        },
    260 
     263        // Initial consent check sequence
    261264        initial_consent_enforcement: function () {
    262265            // Start initial consent enforcement
     
    265268            // First check the initial Metrion consent cookie value (if available)
    266269            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
    269275            window.metrion.helpers.log_debug(("Initial consent enforcement cookie value: " + (metrion_consent_cookie || "null")), "log");
    270276
    271             // If the Metrion consent cookie is emtpy
     277            // If the Metrion consent cookie is NOT emtpy
    272278            if (metrion_consent_cookie !== null) {
    273279                window.metrion.helpers.log_debug("Consent cookie !== to null, so open floodgate.", "log");
     
    275281                try{
    276282                    // 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                    }
    278291                }
    279292                catch(parse_error){
     
    299312                        "allow_uid": Number(cookiebot_cookie.indexOf("necessary:true") > -1).toString(),
    300313                        "allow_sid": Number(cookiebot_cookie.indexOf("necessary:true") > -1).toString(),
    301                         "unix": Date.now()
     314                        "b": blocking_detected,
     315                        "unix": Date.now()
    302316                    }));
    303317
     
    348362                        "allow_uid": Number(cookieyes_object.necessary).toString(),
    349363                        "allow_sid": Number(cookieyes_object.necessary).toString(),
     364                        "b": blocking_detected,
    350365                        "unix": Date.now()
    351366                    }));
     
    390405                        "allow_uid": cmplz_functional,
    391406                        "allow_sid": cmplz_functional,
     407                        "b": blocking_detected,
    392408                        "unix": new Date().getTime()
    393409                    };
     
    416432                        "allow_uid": Number(window.cmplz_has_consent("functional")).toString(),
    417433                        "allow_sid": Number(window.cmplz_has_consent("functional")).toString(),
     434                        "b": blocking_detected,
    418435                        "unix": Date.now()
    419436                    }));
     
    465482                            "allow_uid": allow_necessary,
    466483                            "allow_sid": allow_necessary,
     484                            "b": blocking_detected,
    467485                            "unix": Date.now()
    468486                        }));
     
    499517                        "allow_uid": allow_necessary,
    500518                        "allow_sid": allow_necessary,
     519                        "b": blocking_detected,
    501520                        "unix": Date.now()
    502521                    }));
     
    519538                window.metrion.consent_manager.add_consent_update_listener("cf_consent", window);
    520539            }
     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            }
    521566
    522567            // Evaluate floodgate after
     
    530575                window.metrion.consent_manager.load_destination_js_dynamically();
    531576            }
    532         },
     577
     578            return cmp_allow_marketing
     579        },
     580        // Function to evaluate the floodgate status
    533581        evaluate_consent_floodgate: function () {
    534582            // First check if the floodgate is open
     
    599647            }
    600648        },
    601 
    602 
     649        // Function to manually overwrite the consent settings when no CMP is selected
    603650        update_consent: function (consent_object) {
    604651            var metrion_consent_cookie = window.metrion.helpers.get_cookie_value(window.metrion.configuration.consent_cookie_name);
    605652            if (metrion_consent_cookie !== null) {
    606653                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                }
    607658                updated_consent_object = consent_object;
     659                // Add the blocking parameter
     660                updated_consent_object.b = blocking_detected;
    608661
    609662                // Merge new consent values into the current consent object (the current is the one that needs updating)
     
    623676                );
    624677            }
     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;
    625712        }
    626713    },
     
    744831            });
    745832        }
    746         // Floodgate closed, store event behind floodgate
     833        // Floodgate closed, store event behind floodgate and send ping
    747834        else {
     835            if (metrion.configuration.allow_pings === "1"){
     836                //Trigger the ping
     837                this.send_ping(event_name, event_data);
     838            }
     839
    748840            if (typeof localStorage !== "undefined" && window.metrion.configuration.allow_cookie_placement_before_explicit_consent === "1") {
    749841                //Append to floodgate array in localStorage which is persisstent across pages.
     
    762854    },
    763855
     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
    764876    session_event_logic: function () {
    765877        // Reload session exclusion
     
    9401052        }
    9411053    },
     1054   
     1055    // JS pageview event logic
    9421056    page_view_event_logic: function () {
    9431057        window.metrion.configuration.pageview_send = window.metrion.configuration.pageview_send || false;
     
    9491063        }
    9501064    },
     1065    // JS Woocommerce purchase logic
    9511066    woocommerce_purchase_logic: function (){
    9521067        // jQuery is required for Woocommerce
     
    9781093        });
    9791094    },
     1095    // JS Woocommerce other event logic
    9801096    woocommerce_event_logic: function () {
    9811097        // jQuery is required for Woocommerce
     
    11761292
    11771293
    1178 // User cookie existance handling
     1294// Initialization
    11791295(function () {
     1296    // Check if the user id cookie exists
    11801297    if (window.metrion.helpers.get_cookie_value(metrion_api.user_cookie_name + "_js") === null) {
    11811298        // Only start this process if cookie and data placement is allowed
     
    11861303                window.metrion.session_event_logic();
    11871304                window.metrion.page_view_event_logic();
     1305                window.metrion.woocommerce_purchase_logic()
    11881306                // ALL CODE AFTER THIS IS ONLY FOR NON-CONVERSION ONLY TRACKING
    11891307                if (window.metrion.configuration.purchase_only_tracking != "1") {
    11901308                    window.metrion.woocommerce_event_logic();
    11911309                }
    1192             })
     1310            });
    11931311        }
    11941312        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                }
    12041337            }
    12051338        }
  • metrion/trunk/js/google_ads/events.js

    r3251175 r3288049  
    3737        }
    3838
     39        // Check if gtag exist
    3940        if(gtag_script_loaded === false || typeof window.gtag === "undefined"){
    4041            // Dynamically and Async loading of gtag script
     
    5859            start_google_ads_event_handling();
    5960        }
    60        
    61        
    6261    }
    6362};
     
    116115    // Check if Metrion API and gtag are available before sending events
    117116    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
    156207                for(google_ads_item_i = 0; google_ads_item_i < event_data.event_body.items.length; google_ads_item_i ++ ){
    157208                    google_ads_items.push({
    158209                        id: event_data.event_body.items[google_ads_item_i].id,
    159                         'google_business_vertical': 'retail'
     210                            'google_business_vertical': 'retail'
    160211                    });
    161212                    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));
    162213                }
    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 = [];
    182227                for(google_ads_item_i = 0; google_ads_item_i < event_data.event_body.items.length; google_ads_item_i ++ ){
    183228                    google_ads_items.push({
    184229                        id: event_data.event_body.items[google_ads_item_i].id,
    185                         'google_business_vertical': 'retail'
     230                            'google_business_vertical': 'retail'
    186231                    });
    187232                    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));
    188233                }
    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
    221246        // Process purchase events
    222247        if(event_name === "purchase"){
    223             var google_ads_items = [];
    224248            // Send conversion event to Google Ads
    225249            window.gtag('event', 'conversion', {
     
    230254            });
    231255
    232             // Send enhanced conversion event for deduplication
     256            // GOOGLE ADS CONTEXT CHECKS
    233257            // 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
    241277            window.metrion.helpers.log_debug("Google Ads conversion send through gtag", 'log');
    242278            window.metrion.send_event("google_ads_gtag_purchase_triggered", {
     
    245281                'currency': event_data.event_body.currency,
    246282                '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"
    248287            }, {});
    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        }   
    272289    }
    273290};
  • metrion/trunk/js/meta/events.js

    r3251175 r3288049  
    177177                var collective_value = 0;
    178178                var collective_currency = event_data.event_body.items[0].currency; // Get from the first item
     179               
    179180                // Loop through all items to get the collective parameters necessary for Meta
    180181                for(meta_item_i = 0; meta_item_i < event_data.event_body.items.length; meta_item_i ++ ){
     
    187188                    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));
    188189                }
     190
     191                // Trigger the conversion
    189192                window.fbq('trackSingle', window.metrion_api.meta_pixel_id, "Purchase", {
    190193                    eventID: event_data[window.metrion_api.event_id_name],
  • metrion/trunk/js/microsoft_ads/events.js

    r3251175 r3288049  
    117117    window.uetq = window.uetq || [];
    118118
    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        }
    181202    }
    182203
     
    194215        // Send enhanced conversion event for deduplication
    195216        // 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
    201232        // Send the event and add the relevant identifier
    202233        window.metrion.helpers.log_debug("Microsoft Ads conversion send through uetq", 'log');
     
    205236            "currency": event_data.event_body.currency,
    206237            "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"
    208242        }, {});
    209 
    210         // Additionally, add the dynamic remarketing event if enabled
    211         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 remarketing
    214             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 for
    221             window.uetq.push('event', '', {
    222                 'ecomm_prodid': microsoft_ads_items,
    223                 'ecomm_pagetype': 'purchase'
    224             }); 
    225         }
    226243    }
    227244};
  • metrion/trunk/readme.txt

    r3251175 r3288049  
    33Tags: tracking, pixel, ecommerce tracking, google ads, meta ads
    44Requires at least: 3.8
    5 Tested up to: 6.7
    6 Stable tag: 1.0.0
     5Tested up to: 6.8
     6Stable tag: 1.1.0
    77Requires PHP: 7.1
    88License: GPLv3 or later
     
    1515
    1616Metrion 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 trackign unnecessarily complex and error-prone.
     17Native 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.
    1818By directly integrating into Wordpress you can skip expensive implementation costs and guarantee the highest level of data accuracy for growing your business.
    1919
    2020= Full Metrion Feature List =
    21 * First party & server-side tracking (through webhooks)
    22 * Advanced ad- & trackblocking preventions
     21* First party & server-side tracking
     22* Advanced track-blocking detection
    2323* Consent Management Platform integrations
    2424* No data storage in cookies/browser storage before explicit consent (optional setting)
     
    2828* Google Ads conversion tracking
    2929* Google Ads enhanced conversion tracking (Through Google Ads API)
     30* Google Ads enhanced lead tracking
    3031* Google consent mode V2 (optional)
    3132* Google dynamic remarketing tracking for retail vertical
     
    3738* Microsoft Ads consent mode
    3839* Microsoft Ads dynamic remarketing list functionality
     40* Pre-consent event counting
    3941
    4042== Installation ==
     
    5254- Visit
    5355- Page view
     56- Product view
     57- Product list view
     58- Search result list view
    5459- Add to cart
    55 - cart view
    56 - checkout start
    57 - purchase
     60- Cart view
     61- Checkout start
     62- Purchase
    5863When 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.
    5964This 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).
    6065
    6166= 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 interactions can be shared with Google Ads.
     67When 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.
    6368
    6469Read more about our [terms of use](https://support.google.com/adspolicy/answer/54818?hl=en) and [privacy policy](https://policies.google.com/privacy).
    6570
    6671= 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 interactions can be shared with Meta Ads.
     72When 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.
    6873
    6974Read 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/).
    7075
    7176= 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 Meta Ads.
     77When 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.
    7378
    7479Read more about our [terms of use](https://www.microsoft.com/en/servicesagreement) and [privacy policy](https://www.microsoft.com/en-us/privacy/privacystatement).
     
    8186
    8287== 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
    8393
    8494= 1.0.0 =
  • metrion/trunk/uninstall.php

    r3251175 r3288049  
    4343    'metrion_microsoft_ads_enforce_consent_mode',
    4444    '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'   
    4648];
    4749
  • metrion/trunk/views/settings.php

    r3251175 r3288049  
    66<div>
    77    <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>
    109    <form method="post" action="options.php">
    1110        <?php settings_fields('metrion_options_group'); ?>
     
    131130                        <select id="metrion_cmp_selection" name="metrion_cmp_selection">
    132131                            <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>
    133133                            <option value="cookiebot" <?php selected(get_option('metrion_cmp_selection', 'none'), 'cookiebot'); ?>>CookieBot</option>
    134134                            <option value="cookieyes" <?php selected(get_option('metrion_cmp_selection', 'none'), 'cookieyes'); ?>>CookieYes</option>
     
    196196                    </td>               
    197197                </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>
    198223            </table>
    199224            <!-- Google Ads settings -->
     
    211236                </tr>
    212237                <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">
    213247                    <th scope="row"><label for="metrion_google_ads_account_id">Google Ads Account ID</label></th>
    214248                    <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>
     
    237271                    </td>
    238272                </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
    248274                <tr valign="top">
    249275                    <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.