Changeset 2895357
- Timestamp:
- 04/07/2023 01:58:49 AM (3 years ago)
- Location:
- microsoft-advertising-universal-event-tracking-uet
- Files:
-
- 7 added
- 1 deleted
- 3 edited
-
tags/1.0.4 (deleted)
-
tags/1.0.5 (added)
-
tags/1.0.5/CONTRIBUTING.txt (added)
-
tags/1.0.5/LICENSE.txt (added)
-
tags/1.0.5/README.txt (added)
-
tags/1.0.5/tagid.php (added)
-
tags/1.0.5/uninstall.php (added)
-
tags/1.0.5/wp-uet-plugin.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/tagid.php (modified) (1 diff)
-
trunk/wp-uet-plugin.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
microsoft-advertising-universal-event-tracking-uet/trunk/README.txt
r2749425 r2895357 6 6 Requires PHP: 7.2 7 7 License: MIT 8 Stable tag: 1.0. 48 Stable tag: 1.0.5 9 9 10 10 The official plugin for setting up Microsoft Advertising UET … … 21 21 22 22 == Changelog == 23 = 1.0.5= 24 * update to support SPA detection 23 25 24 26 = 1.0.4= -
microsoft-advertising-universal-event-tracking-uet/trunk/tagid.php
r2531528 r2895357 1 1 <?php 2 2 $tagid = ''; 3 $enableSpaTracking = ''; 3 4 ?> -
microsoft-advertising-universal-event-tracking-uet/trunk/wp-uet-plugin.php
r2749425 r2895357 7 7 * Plugin URI: https://ads.microsoft.com/ 8 8 * Description: The official plugin for setting up Microsoft Advertising UET. 9 * Version: 1.0. 49 * Version: 1.0.5 10 10 * Author: Microsoft Corporation 11 11 * Author URI: https://www.microsoft.com/ … … 13 13 */ 14 14 15 // NOTE: If you update 'Version' above, update the 'tm' parameter in the script , around line 42.15 // NOTE: If you update 'Version' above, update the 'tm' parameter in the script. 16 16 17 17 // … … 41 41 } 42 42 43 function UserSettingForEnableAutoSpaTracking() { 44 $options = get_option('UetTagSettings'); 45 if(!empty($options['enable_spa_tracking'])) 46 { 47 $enableSpa_bool = filter_var($options['enable_spa_tracking'], FILTER_VALIDATE_BOOLEAN); 48 if($enableSpa_bool) 49 { 50 return $options['enable_spa_tracking']; 51 } 52 } 53 return 'false'; 54 } 55 43 56 function UetPageLoadEvent() { 44 57 if (!UetIsTagAvailable()) return null; 45 58 ?> 46 <script>(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"<?php 47 $options = get_option('UetTagSettings'); 48 $uet_tag_id = $options['uet_tag_id']; 49 if (ctype_digit($uet_tag_id)) { 50 echo esc_attr($uet_tag_id); 51 } 52 else{ 53 echo ''; 54 } 55 ?>",tm:"wpp_1.0.4"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");</script> 59 <script> 60 (function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){ 61 var o={ti:"<?php 62 $options = get_option('UetTagSettings'); 63 $uet_tag_id = $options['uet_tag_id']; 64 if (ctype_digit($uet_tag_id)) { 65 echo esc_attr($uet_tag_id); 66 } 67 else{ 68 echo ''; 69 } 70 ?>", 71 enableAutoSpaTracking: <?php 72 echo esc_attr(UserSettingForEnableAutoSpaTracking()) 73 ?>, 74 tm:"wpp_1.0.5"}; 75 o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")}, 76 n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function() 77 {var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq"); 78 </script> 56 79 <?php 57 80 return null; … … 83 106 add_settings_section('uet_general_settings_section', '', 'UetRenderGeneralSettingsSectionHeader', 'uet_tag_settings_page'); 84 107 add_settings_field('uet_tag_id', 'UET Tag ID', 'UetEchoTagId', 'uet_tag_settings_page', 'uet_general_settings_section'); 108 add_settings_field('enable_spa_tracking', "Enable SPA Tracking", "UetEchoEnableSpa", 'uet_tag_settings_page', 'uet_general_settings_section'); 85 109 86 110 if(is_admin() && get_option('Activated_Plugin') == 'microsoft-advertising-universal-event-tracking-uet') { … … 95 119 } 96 120 } 97 } 121 122 if(empty($options['enable_spa_tracking'])&& !empty($enableSpaTracking)){ 123 if (filter_var($enableSpaTracking, FILTER_VALIDATE_BOOLEAN)){ 124 $options['enable_spa_tracking'] = $enableSpaTracking; 125 } 126 else 127 { 128 $options['enable_spa_tracking'] = 'false'; 129 } 130 update_option('UetTagSettings', $options); 131 } 132 } 98 133 } 99 134 … … 117 152 } 118 153 154 function UetEchoEnableSpa() { 155 $options = get_option('UetTagSettings'); 156 $enableSpa = ''; 157 if(isset($options['enable_spa_tracking']) && filter_var($options['enable_spa_tracking'], FILTER_VALIDATE_BOOLEAN)){ 158 $enableSpa = $options['enable_spa_tracking']; 159 echo "<input id='enable_spa_tracking' name='UetTagSettings[enable_spa_tracking]' type='text' value='" .esc_attr($enableSpa) ."' />"; 160 } 161 else 162 { 163 echo "<input id='enable_spa_tracking' name='UetTagSettings[enable_spa_tracking]' type='text' value='" .esc_attr('false') ."' />"; 164 } 165 } 166 119 167 function UetShowAdminNotice() { 120 168 if (UetIsTagAvailable()) return; … … 133 181 return $links; 134 182 } 183 135 184 ?>
Note: See TracChangeset
for help on using the changeset viewer.