Plugin Directory

Changeset 2814352


Ignore:
Timestamp:
11/08/2022 02:00:27 PM (3 years ago)
Author:
vinema
Message:

Allow automatic script blocking for cookie consent

Location:
vine-ma/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vine-ma/trunk/readme.txt

    r2813472 r2814352  
    2121
    2222== Changelog ==
     23
     24= 1.1.7 =
     25* Allow automatic script blocking for cookie consent.
    2326
    2427= 1.1.6 =
  • vine-ma/trunk/vine_ma_plugin.php

    r2765186 r2814352  
    33/**
    44 * Plugin Name: Vine MA - Email Marketing, Forms, Interactive Bot Forms, Chatbot, Analytics
    5  * Version: 1.1.6
     5 * Version: 1.1.7
    66 * Description: Vine is a Marketing automation tool to generate more leads from your web site. Vine includes web forms, interactive bot forms, landing pages, AI chatbot, visitor tracking, and other functionality to help you to make your site more interesting and to know better what your visitors do there.
    77 * Author: Vine Oy
     
    9292    $orgid = vine_ma_get_option('organization_id');
    9393    $src = VINEHOST."/track/t.js?sg={$orgid}";
    94     wp_enqueue_script('vinematrack', $src, array(), null);
    95     wp_script_add_data('vinematrack', 'main-track-script', true );
    9694    $srcac = VINEHOST."/track/allowCookies.js";
    97     wp_enqueue_script('vinematrackac', $srcac, array(), null);
    98     wp_script_add_data('vinematrackac', 'ac-track-script', true );
    99 }
    100 function vine_track_scripts_attributes( $tag, $handle ) {
    101     if ( is_user_logged_in() && isset($_GET['et_fb']) && isset($_GET['PageSpeed'])) return $tag;
    102     if ( wp_scripts()->get_data( $handle, 'main-track-script' ) ) {
    103         $tag = str_replace( '></', ' data-cookieconsent="ignore"></', $tag );
    104         $tag = str_replace( '<script', '<script type="text/javascript"', $tag );
    105     }
    106     if ( wp_scripts()->get_data( $handle, 'ac-track-script' ) ) {
    107         $tag = str_replace( '></', ' data-cookieconsent="marketing" async></', $tag );
    108         $tag = str_replace( '<script', '<script type="text/plain"', $tag );
    109     }
    110     return $tag;
    111 }
    112 add_action( 'wp_enqueue_scripts', 'vine_ma_wpes_hook_add_script');
    113 add_filter( 'script_loader_tag', 'vine_track_scripts_attributes', 10, 2 );
     95    ?>
     96        <script type="text/javascript" src="<?php echo $src ?>" data-cookieconsent="ignore"></script>
     97        <script type="text/plain" src="<?php echo $srcac ?>" data-cookieconsent="marketing" async></script>
     98    <?php
     99}
     100 
     101add_action( 'wp_head', 'vine_ma_wpes_hook_add_script', -99999);
    114102
    115103add_action( 'wp_ajax_vine_ma_save_option', 'vine_ma_hook_save_option' );
Note: See TracChangeset for help on using the changeset viewer.