Changeset 880002
- Timestamp:
- 03/22/2014 02:15:45 PM (12 years ago)
- Location:
- google-analytics-injector/trunk
- Files:
-
- 2 edited
-
google-analytics-injector.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
google-analytics-injector/trunk/google-analytics-injector.php
r822493 r880002 5 5 Description: Google Analytics Injector plugin let you inject Google Analytics tracking code into your website to 6 6 collect statistics about your visitors. Just add your tracking code from Google Analytics to start the tracking. 7 Version: 1.1. 17 Version: 1.1.2 8 8 Author: Niklas Olsson 9 9 Author URI: http://www.geckosolutions.se … … 46 46 if (!current_user_can('edit_posts') && get_option('ua_tracking_code') != "") { 47 47 echo "<!-- Google Analytics Injector from http://www.geckosolutions.se/blog/wordpress-plugins/ -->\n"; 48 echo get_google_analytics_tracking_code(get_option('ua_tracking_code'), get_option('site_restriction_url') );48 echo get_google_analytics_tracking_code(get_option('ua_tracking_code'), get_option('site_restriction_url'), get_option('site_domain_url')); 49 49 echo "\n<!-- Google Analytics Injector -->\n"; 50 50 } … … 59 59 * @return the tracking code to render. 60 60 */ 61 function get_google_analytics_tracking_code($ua_tracking_code, $site_restriction_url ) {61 function get_google_analytics_tracking_code($ua_tracking_code, $site_restriction_url, $site_domain_url) { 62 62 $google_tracking_code = "<script type='text/javascript'>"; 63 63 $google_tracking_code .= ""; … … 65 65 $google_tracking_code .= " 66 66 var site = '' + document.location; 67 if (site.indexOf('".$site_restriction_url."') > -1 ) { 68 "; 67 if(site.indexOf('".$site_restriction_url."') == -1 ) {"; 69 68 } 70 69 $google_tracking_code .= " 71 70 var _gaq = _gaq || []; 72 _gaq.push(['_setAccount', '".$ua_tracking_code."']); 73 _gaq.push(['_trackPageview']); 74 71 _gaq.push(['_setAccount', '".$ua_tracking_code."']);"; 72 if($site_domain_url) { 73 $google_tracking_code .= "_gaq.push(['_setDomainName', '".$site_domain_url."']);"; 74 } 75 $google_tracking_code .= "_gaq.push(['_trackPageview']); 75 76 (function() { 76 77 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; … … 127 128 ?> 128 129 <input type="text" name="ua_tracking_code" id="ua_tracking_code" value="<?php echo get_option('ua_tracking_code'); ?>" style="width:400px;"/> 129 130 131 <h4 style="margin-bottom: 0px;"><?php echo __('Your domain eg. .mydomain.com', 'google-analytics-injector'); ?></h4> 132 <input type="text" name="site_domain_url" id="site_domain_url" value="<?php echo get_option('site_domain_url'); ?>" /> 133 130 134 <h4 style="margin-bottom: 0px;"><?php echo __('Restrict tracking to this domain http://', 'google-analytics-injector'); ?></h4> 131 135 <input type="text" name="site_restriction_url" id="site_restriction_url" value="<?php echo get_option('site_restriction_url'); ?>" style="width:400px;"/> … … 175 179 $errors = new WP_Error('tracking_code', __('The tracking code is on the wrong format', 'google-analytics-injector')); 176 180 } 177 181 182 if(isset($_POST['site_domain_url'])) { 183 update_option('site_domain_url', $_POST['site_domain_url']); 184 } 185 178 186 if(isset($_POST['site_restriction_url'])) { 179 187 update_option('site_restriction_url', $_POST['site_restriction_url']); -
google-analytics-injector/trunk/readme.txt
r822493 r880002 5 5 Tags: google, google analytics, analytics, statistics, stats, javascript, web analytics, 6 6 Requires at least: 3.0 7 Tested up to: 3.8 8 Stable tag: 1.1. 17 Tested up to: 3.8.1 8 Stable tag: 1.1.2 9 9 10 10 == Description == … … 46 46 * The plugin now exclude the visits from the Administrator. (bug fix) 47 47 * Tested stability up to Wordpress 3.8 48 49 = 1.1.2 = 50 * Added option for _setDomainName 51 * The plugin now exclude the visits from given restricted url. (bug fix) 52 * Tested stability up to Wordpress 3.8.1
Note: See TracChangeset
for help on using the changeset viewer.