Plugin Directory

Changeset 1864266


Ignore:
Timestamp:
04/25/2018 04:25:56 PM (8 years ago)
Author:
BenDlz
Message:

0.1.4

  • Add asynchronous tag setting
  • Bug fix (on pages)
Location:
at-internet/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • at-internet/trunk/atinternet-smarttag.php

    r1729337 r1864266  
    22/*
    33 * Plugin Name: AT Internet SmartTag
    4  * Version: 0.1.3
     4 * Version: 0.1.4
    55 * Plugin URI: http://www.atinternet.com/
    66 * Description: AT Internet official extension, allowing website tracking.
     
    88 * Author URI: http://www.atinternet.com/
    99 * Requires at least: 4.0
    10  * Tested up to: 4.7.3
     10 * Tested up to: 4.9.5
    1111 *
    1212 * Text Domain: atinternet-smarttag
  • at-internet/trunk/includes/class-atinternet-smarttag-settings.php

    r1631751 r1864266  
    132132                    'label'         => __( 'Use SSL only?', 'at-internet' ),
    133133                    'description'   => __( 'Use only secure collect?', 'at-internet' ),
     134                    'type'          => 'checkbox',
     135                    'default'       => ''
     136                ),
     137                array(
     138                    'id'            => 'async',
     139                    'label'         => __( 'Use asynchronous tag?', 'at-internet' ),
    134140                    'type'          => 'checkbox',
    135141                    'default'       => ''
  • at-internet/trunk/includes/lib/class-atinternet-smarttag-tracking-js-builder.php

    r1631751 r1864266  
    8282        return 'var ' . $this->tracker_name . ' = new ATInternet.Tracker.Tag(' . json_encode( $this->configuration ) . ');';
    8383    }
     84   
     85    /**
     86     * Tracker initialisation.
     87     * @access  private
     88     * @since   1.0.0
     89     * @return  string
     90     */
     91    private function tracker_init_async() {
     92        return 'window.' . $this->tracker_name . ' = new window.ATInternet.Tracker.Tag(' . json_encode( $this->configuration ) . ');';
     93    }
    8494
    8595    /**
     
    119129     * @return  string
    120130     */
    121     public function display() {
    122         echo $this->get_tracker();
     131    public function display($async) {
     132        if($async) echo $this->get_tracker_async();
     133        else echo $this->get_tracker();
    123134    }
    124135
     
    140151        return $the_tracker;
    141152    }
     153   
     154    /**
     155     * Get the full tracker.
     156     * @access  public
     157     * @since   1.0.0
     158     * @return  string
     159     */
     160    public function get_tracker_async() {
     161        $the_tracker = "<script type=\"text/javascript\">";
     162        $the_tracker .= "\nwindow.ATInternet = {";
     163        $the_tracker .= "\n  onTrackerLoad:function(){";
     164        $the_tracker .= "\n    " . $this->tracker_init_async();
     165        foreach ( $this->functionnalities as $functionnality ) {
     166            $the_tracker .= "\n    " . $this->$functionnality();
     167        }
     168        $the_tracker .= "\n    " . $this->tracker_dispatch();
     169        $the_tracker .= "\n  }";
     170        $the_tracker .= "\n}";
     171        $the_tracker .= "\n</script>";
     172
     173        return $the_tracker;
     174    }
    142175
    143176}
  • at-internet/trunk/includes/lib/class-atinternet-smarttag-tracking-tree-structure.php

    r1729337 r1864266  
    123123    private function get_categories() {
    124124        $categories = array();
    125         if( $this->screen_type == 'post' ) $categories = get_the_terms( $this->post_id, 'category' );
    126         if( $this->screen_type == 'product' ) $categories = get_the_terms( $this->post_id, 'product_cat' );
     125        if( $this->screen_type == 'post' ) $categories = get_the_terms( $this->post_id, 'category' ) ?: array();
     126        if( $this->screen_type == 'product' ) $categories = get_the_terms( $this->post_id, 'product_cat' )  ?: array();
    127127
    128128        $categories = array_values( $categories );
  • at-internet/trunk/includes/lib/class-atinternet-smarttag-tracking.php

    r1631751 r1864266  
    7676        if( $this->screen_type == 'search' ) $the_tracker->add( 'internal_search', $this->get_internal_search() );
    7777
     78        $conf_async = ( get_option( $this->prefix . 'async' ) === 'on' ) ? 1 : 0;
    7879        // Display tracking code
    79         $the_tracker->display();
     80        $the_tracker->display($conf_async);
    8081
    8182    }
  • at-internet/trunk/readme.txt

    r1729337 r1864266  
    33Tags: AT Internet, Analytics, Tracking, Woocommerce
    44Requires at least: 4.0
    5 Tested up to: 4.7.3
     5Tested up to: 4.9.5
    66Stable tag: trunk
    77License: GPLv2 or later
     
    3232== Changelog ==
    3333
     34= 0.1.4 =
     35* 2018-04-25
     36* Add asynchronous tag setting
     37* Bug fix (on pages)
     38
    3439= 0.1.3 =
    3540* 2017-09-13
Note: See TracChangeset for help on using the changeset viewer.