Changeset 1934840
- Timestamp:
- 09/03/2018 08:51:17 AM (8 years ago)
- Location:
- tealium/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (3 diffs)
-
tealium.options.php (modified) (1 diff)
-
tealium.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tealium/trunk/readme.txt
r1891113 r1934840 4 4 Donate link: http://tealium.com 5 5 Requires at least: 3.0.1 6 Tested up to: 4.9. 67 Stable tag: 2.1. 96 Tested up to: 4.9.8 7 Stable tag: 2.1.10 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 104 104 == Changelog == 105 105 106 = 2.1.10 = 107 * Add support for alternative utag_data namespace. 108 * Fix issue with tag injection despite AMP. 109 106 110 = 2.1.9 = 107 111 * Add translation support and template. … … 179 183 == Upgrade Notice == 180 184 185 = 2.1.10 = 186 Add support for alternative utag_data namespace. 187 Fix issue with tag injection despite AMP. 188 181 189 = 2.1.9 = 182 190 Add translation support and template. -
tealium/trunk/tealium.options.php
r1538476 r1934840 236 236 </td> 237 237 </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> 238 245 </table> 239 246 -
tealium/trunk/tealium.php
r1891113 r1934840 4 4 Plugin URI: http://tealium.com 5 5 Description: Adds the Tealium tag and creates a data layer for your WordPress site. 6 Version: 2.1. 96 Version: 2.1.10 7 7 Author: Ian Hampton - Tealium EMEA 8 8 Author URI: http://tealium.com … … 34 34 add_option( 'tealiumEUOnly', '' ); 35 35 add_option( 'tealiumExcludeMetaData', '' ); 36 add_option( 'tealiumNamespace', '' ); 36 37 } 37 38 … … 51 52 delete_option( 'tealiumEUOnly' ); 52 53 delete_option( 'tealiumExcludeMetaData' ); 54 delete_option( 'tealiumNamespace' ); 53 55 } 54 56 … … 67 69 register_setting( 'tealiumTagAdvanced', 'tealiumEUOnly' ); 68 70 register_setting( 'tealiumTagAdvanced', 'tealiumExcludeMetaData' ); 71 register_setting( 'tealiumTagAdvanced', 'tealiumNamespace' ); 69 72 70 73 wp_register_style( 'tealium-stylesheet', plugins_url( 'tealium.css', __FILE__ ) ); … … 375 378 // Output data object 376 379 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"; 378 386 if ( !$return ) { 379 387 echo $utag_data; … … 538 546 $tiqCDN = ( "1" == get_option( 'tealiumEUOnly' ) ? "tags-eu.tiqcdn.com" : "tags.tiqcdn.com" ); 539 547 return $tiqCDN; 548 } 549 550 /* 551 * Determine if the current page is using AMP 552 */ 553 function 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 } 540 563 } 541 564 … … 630 653 } 631 654 else { 632 // Insert the Tealium tag 633 add_action( 'init', 'insertTealiumTag' ); 655 if ( !tealiumAMP() ) { 656 // Insert the Tealium tag 657 add_action( 'init', 'insertTealiumTag' ); 658 } 634 659 635 660 // Insert the data object
Note: See TracChangeset
for help on using the changeset viewer.