Plugin Directory

Changeset 1640953


Ignore:
Timestamp:
04/19/2017 11:20:35 PM (9 years ago)
Author:
dustyn
Message:

Add updated actions and filters, update version number

Location:
simple-google-analytics-tracking
Files:
10 added
4 edited

Legend:

Unmodified
Added
Removed
  • simple-google-analytics-tracking/trunk/README.txt

    r1299202 r1640953  
    33Tags: google, analytics, google analytics, simple, tracking, google analytics tracking, simple google analytics tracking, sgat, simple google analytics, simple tracking
    44Requires at least: 3.8
    5 Tested up to: 4.3.1
    6 Stable tag: 1.2.1
     5Tested up to: 4.7.3
     6Stable tag: 1.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3434Yes, the Tracking ID can be changed with the `sgat_tracking_id` filter.
    3535
     36= Can the Tracking Fields be added programatically? =
     37
     38Yes, the Tracking Fields can be changed with the `sgat_tracker_create_fields` filter.
     39
     40= Can additional tracking calls be added after Google Analytics? =
     41
     42Yes, additional tracking calls be added after Google Analytics is added with the `sgat_after_tracker` action.
     43
    3644== Screenshots ==
    3745
     
    6270}
    6371`
     72
     73`sgat_tracker_create_fields `: Used to modify the information when creating the Google Analytics tracker.
     74
     75Example Usage:
     76`
     77add_filter( 'sgat_tracker_create_fields', 'sgat_custom_tracker_create_fields' );
     78function sgat_custom_tracker_create_fields( $fields ) {
     79  $fields['siteSpeedSampleRate'] = 50;
     80  return $fields;
     81}
     82`
     83
     84`sgat_after_tracker `: Used to add additional Google Analytics calls after the main tracker output.
     85
     86Example Usage:
     87`
     88add_action( 'sgat_after_tracker', 'sgat_after_tracker_functionality’ );
     89function sgat_after_tracker_functionality() {
     90  echo "ga('send', 'event', 'MyCategory', 'MyAction', 'MyLabel', 50);";
     91}
     92`
  • simple-google-analytics-tracking/trunk/includes/simple-ga-tracking-input.php

    r1299202 r1640953  
    55
    66function sgat_add_option() {
    7     add_options_page( 'Google Analtics', 'Google Analytics', 'manage_options', 'simple-google-analytics-tracking.php', 'sgat_admin_input' );
     7    add_options_page( 'Google Analytics', 'Google Analytics', 'manage_options', 'simple-google-analytics-tracking.php', 'sgat_admin_input' );
    88}
    99
  • simple-google-analytics-tracking/trunk/includes/simple-ga-tracking-output.php

    r1098390 r1640953  
    77
    88    $tracking_id = apply_filters( 'sgat_tracking_id', get_option("sgat_tracking_code") );
    9    
     9    $create_options = apply_filters( 'sgat_tracker_create_fields', array(
     10        'cookieDomain'  => 'auto',
     11        'trackingId'    => $tracking_id,
     12    ) );
     13
    1014    if(
    1115        !empty( $tracking_id ) // There is a tracking code
     
    2024        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    2125
    22         ga('create', '<?php echo esc_attr( $tracking_id ); ?>', 'auto');
     26        ga('create', <?php echo json_encode( $create_options ); ?> );
    2327        ga('send', 'pageview');
     28        <?php do_action( 'sgat_after_tracker' ); ?>
    2429
    2530    </script>
  • simple-google-analytics-tracking/trunk/simple-google-analytics-tracking.php

    r1098390 r1640953  
    55Description: Add Google Analytics Tracking to your site easily with your Tracking ID.
    66Author: Dustyn Doyle
    7 Version: 1.2
     7Version: 1.3
    88Author URI: http://www.dustyndoyle.com
    99*/
    10 /*  Copyright 2015  dustyn  (email : dustyn_doyle@yahoo.com)
     10/*  Copyright 2017  dustyn  (email : dustyn_doyle@yahoo.com)
    1111
    1212    This program is free software; you can redistribute it and/or modify
Note: See TracChangeset for help on using the changeset viewer.