Changeset 2201674
- Timestamp:
- 11/26/2019 11:08:01 PM (6 years ago)
- Location:
- tiny-desk-pixel/trunk
- Files:
-
- 3 edited
-
public/class-tiny-desk-pixel-public.php (modified) (1 diff)
-
public/js/tiny-desk-pixel-public.js (modified) (1 diff)
-
tiny-desk-pixel.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tiny-desk-pixel/trunk/public/class-tiny-desk-pixel-public.php
r2131092 r2201674 98 98 99 99 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/tiny-desk-pixel-public.js', array( 'jquery' ), $this->version, false ); 100 101 $advertiserId = get_option('tiny-desk-advertiser-id'); 102 $pixelId = get_option('tiny-desk-pixel-id'); 103 $ttdConfig = array( 'advertiserId' => $advertiserId, 'pixelId' => $pixelId ); 104 105 wp_localize_script( $this->plugin_name, 'ttdConfig', $ttdConfig ); 100 106 } 101 107 -
tiny-desk-pixel/trunk/public/js/tiny-desk-pixel-public.js
r2106481 r2201674 1 1 (function( $ ) { 2 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 3 function clickListener(event) { 4 if(event.target.tagName.toLowerCase() === 'a') { 5 const href = event.target.href; 6 const telRegex = /^tel:/g; 7 const mapRegex = /(goo.gl|google.com)\/maps\//; 8 if((telRegex.test(href) || mapRegex.test(href)) && typeof TTDUniversalPixelApi === "function") { 9 var universalPixelApi = new TTDUniversalPixelApi(`contact_${telRegex.test(href) ? 'tel' : 'map'}`); 10 universalPixelApi.init(ttdConfig.advertiserId, [ttdConfig.pixelId], "https://insight.adsrvr.org/track/up"); 11 } 12 } 13 } 14 $( window ).load(function() { 15 document.body.addEventListener('click', clickListener, true); 16 }); 31 17 32 18 })( jQuery ); -
tiny-desk-pixel/trunk/tiny-desk-pixel.php
r2131092 r2201674 15 15 * Plugin URI: www.thetradedesk.com 16 16 * Description: It helps you add easily your tracking tag from Tiny Desk by just giving your advertiser id and pixel id. 17 * Version: 1.0. 217 * Version: 1.0.3 18 18 * Author: The Trade Desk 19 19 * Author URI: https://profiles.wordpress.org/thetinydesk/ … … 34 34 * Rename this for your plugin and update it as you release new versions. 35 35 */ 36 define( 'TINY_DESK_PIXEL_VERSION', '1.0. 2' );36 define( 'TINY_DESK_PIXEL_VERSION', '1.0.3' ); 37 37 38 38 /**
Note: See TracChangeset
for help on using the changeset viewer.