Plugin Directory

Changeset 1934840


Ignore:
Timestamp:
09/03/2018 08:51:17 AM (8 years ago)
Author:
tealium
Message:

Commit 2.1.10

Location:
tealium/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tealium/trunk/readme.txt

    r1891113 r1934840  
    44Donate link: http://tealium.com
    55Requires at least: 3.0.1
    6 Tested up to: 4.9.6
    7 Stable tag: 2.1.9
     6Tested up to: 4.9.8
     7Stable tag: 2.1.10
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    104104== Changelog ==
    105105
     106= 2.1.10 =
     107* Add support for alternative utag_data namespace.
     108* Fix issue with tag injection despite AMP.
     109
    106110= 2.1.9 =
    107111* Add translation support and template.
     
    179183== Upgrade Notice ==
    180184
     185= 2.1.10 =
     186Add support for alternative utag_data namespace.
     187Fix issue with tag injection despite AMP.
     188
    181189= 2.1.9 =
    182190Add translation support and template.
  • tealium/trunk/tealium.options.php

    r1538476 r1934840  
    236236                    </td>
    237237                </tr>
     238                <tr>
     239                    <th scope="row"><label for="tealiumNamespace"><?php _e( 'Custom namespace', 'tealium' ); ?></label></th>
     240                    <td>
     241                        <input name='tealiumNamespace' id='tealiumNamespace' size='50' type='text' value='<?php echo get_option( 'tealiumNamespace' ); ?>' class='regular-text' />
     242                        <p class="description"><?php _e( 'Use a custom namespace for the data layer instead of the default <code>utag_data</code>', 'tealium' ); ?></p>
     243                    </td>
     244                </tr>
    238245            </table>
    239246
  • tealium/trunk/tealium.php

    r1891113 r1934840  
    44Plugin URI: http://tealium.com
    55Description: Adds the Tealium tag and creates a data layer for your WordPress site.
    6 Version: 2.1.9
     6Version: 2.1.10
    77Author: Ian Hampton - Tealium EMEA
    88Author URI: http://tealium.com
     
    3434    add_option( 'tealiumEUOnly', '' );
    3535    add_option( 'tealiumExcludeMetaData', '' );
     36    add_option( 'tealiumNamespace', '' );
    3637}
    3738
     
    5152    delete_option( 'tealiumEUOnly' );
    5253    delete_option( 'tealiumExcludeMetaData' );
     54    delete_option( 'tealiumNamespace' );
    5355}
    5456
     
    6769    register_setting( 'tealiumTagAdvanced', 'tealiumEUOnly' );
    6870    register_setting( 'tealiumTagAdvanced', 'tealiumExcludeMetaData' );
     71    register_setting( 'tealiumTagAdvanced', 'tealiumNamespace' );
    6972
    7073    wp_register_style( 'tealium-stylesheet', plugins_url( 'tealium.css', __FILE__ ) );
     
    375378    // Output data object
    376379    if ( json_decode( str_replace("\u0000*\u0000", "", $jsondata) ) !== null ) {
    377         $utag_data = "<script type=\"text/javascript\">\nvar utag_data = {$jsondata};\n</script>\n";
     380       
     381        // Get custom namespace value if set
     382        $tealiumNamespace = get_option( 'tealiumNamespace' , 'utag_data' );
     383        $tealiumNamespace = ( empty( $tealiumNamespace ) ? 'utag_data' : $tealiumNamespace );
     384       
     385        $utag_data = "<script type=\"text/javascript\">\nvar {$tealiumNamespace} = {$jsondata};\n</script>\n";
    378386        if ( !$return ) {
    379387            echo $utag_data;
     
    538546    $tiqCDN = ( "1" == get_option( 'tealiumEUOnly' ) ? "tags-eu.tiqcdn.com" : "tags.tiqcdn.com" );
    539547    return $tiqCDN;
     548}
     549
     550/*
     551 * Determine if the current page is using AMP
     552 */
     553function tealiumAMP() {
     554    if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
     555        return true;
     556    }
     557    else {
     558        if ( ( defined( 'AMPFORWP_VERSION' ) || defined( 'AMP__VERSION' ) ) && preg_match( '/\/amp\/?$/', $_SERVER['REQUEST_URI'] ) ) {
     559            return true;
     560        }
     561        return false;
     562    }
    540563}
    541564
     
    630653}
    631654else {
    632     // Insert the Tealium tag
    633     add_action( 'init', 'insertTealiumTag' );
     655    if ( !tealiumAMP() ) {
     656        // Insert the Tealium tag
     657        add_action( 'init', 'insertTealiumTag' );
     658    }
    634659
    635660    // Insert the data object
Note: See TracChangeset for help on using the changeset viewer.