GA Google Analytics - Version 20191109

Version Description

To upgrade GA Google Analytics, remove the old version and replace with the new version. Or just click "Update" from the Plugins screen and let WordPress do it for you automatically.

Note: uninstalling the plugin from the WP Plugins screen results in the removal of all settings from the WP database.

For more information, visit the GA Plugin Homepage.

Download this release

Release Info

Developer specialk
Plugin Icon 128x128 GA Google Analytics
Version 20191109
Comparing to
See all releases

Code changes from version 20190902 to 20191109

css/settings.css CHANGED
@@ -25,7 +25,7 @@
25
  .wp-admin .gap-panel-settings table { border: 0; }
26
  .wp-admin .gap-panel-settings th { width: 25%; vertical-align: middle; }
27
  .wp-admin .gap-panel-settings td { padding: 15px; vertical-align: middle; }
28
- .wp-admin .gap-panel-settings td input[type="checkbox"] { position: relative; top: -2px; }
29
  .wp-admin .gap-panel-settings td textarea { box-sizing: border-box; width: 96%; }
30
  .wp-admin .gap-panel-settings td textarea + .gap-caption { width: 95%; }
31
 
25
  .wp-admin .gap-panel-settings table { border: 0; }
26
  .wp-admin .gap-panel-settings th { width: 25%; vertical-align: middle; }
27
  .wp-admin .gap-panel-settings td { padding: 15px; vertical-align: middle; }
28
+ .wp-admin .gap-panel-settings td input[type=checkbox] { position: relative; top: -2px; }
29
  .wp-admin .gap-panel-settings td textarea { box-sizing: border-box; width: 96%; }
30
  .wp-admin .gap-panel-settings td textarea + .gap-caption { width: 95%; }
31
 
ga-google-analytics.php CHANGED
@@ -9,9 +9,9 @@
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
  Requires at least: 4.1
12
- Tested up to: 5.2
13
- Stable tag: 20190902
14
- Version: 20190902
15
  Requires PHP: 5.6.20
16
  Text Domain: ga-google-analytics
17
  Domain Path: /languages
@@ -60,7 +60,7 @@ if (!class_exists('GA_Google_Analytics')) {
60
 
61
  function constants() {
62
 
63
- if (!defined('GAP_VERSION')) define('GAP_VERSION', '20190902');
64
  if (!defined('GAP_REQUIRE')) define('GAP_REQUIRE', '4.1');
65
  if (!defined('GAP_AUTHOR')) define('GAP_AUTHOR', 'Jeff Starr');
66
  if (!defined('GAP_NAME')) define('GAP_NAME', __('GA Google Analytics', 'ga-google-analytics'));
@@ -347,11 +347,11 @@ if (!class_exists('GA_Google_Analytics')) {
347
  if (!isset($input['gap_custom_loc'])) $input['gap_custom_loc'] = null;
348
  $input['gap_custom_loc'] = ($input['gap_custom_loc'] == 1 ? 1 : 0);
349
 
350
- if (isset($input['tracker_object'])) $input['tracker_object'] = stripslashes(trim($input['tracker_object']));
351
 
352
- if (isset($input['gap_custom_code'])) $input['gap_custom_code'] = stripslashes(trim($input['gap_custom_code']));
353
 
354
- if (isset($input['gap_custom'])) $input['gap_custom'] = stripslashes(trim($input['gap_custom']));
355
 
356
  return $input;
357
 
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
  Requires at least: 4.1
12
+ Tested up to: 5.3
13
+ Stable tag: 20191109
14
+ Version: 20191109
15
  Requires PHP: 5.6.20
16
  Text Domain: ga-google-analytics
17
  Domain Path: /languages
60
 
61
  function constants() {
62
 
63
+ if (!defined('GAP_VERSION')) define('GAP_VERSION', '20191109');
64
  if (!defined('GAP_REQUIRE')) define('GAP_REQUIRE', '4.1');
65
  if (!defined('GAP_AUTHOR')) define('GAP_AUTHOR', 'Jeff Starr');
66
  if (!defined('GAP_NAME')) define('GAP_NAME', __('GA Google Analytics', 'ga-google-analytics'));
347
  if (!isset($input['gap_custom_loc'])) $input['gap_custom_loc'] = null;
348
  $input['gap_custom_loc'] = ($input['gap_custom_loc'] == 1 ? 1 : 0);
349
 
350
+ if (isset($input['tracker_object'])) $input['tracker_object'] = wp_strip_all_tags(trim($input['tracker_object']));
351
 
352
+ if (isset($input['gap_custom_code'])) $input['gap_custom_code'] = wp_strip_all_tags(trim($input['gap_custom_code']));
353
 
354
+ if (isset($input['gap_custom'])) $input['gap_custom'] = stripslashes($input['gap_custom']);
355
 
356
  return $input;
357
 
inc/plugin-core.php CHANGED
@@ -76,8 +76,7 @@ function ga_google_analytics_universal() {
76
 
77
  extract(ga_google_analytics_options());
78
 
79
- $custom_code = ga_google_analytics_custom($custom_code);
80
- $custom_code = explode(PHP_EOL, $custom_code);
81
 
82
  $ga_display = "ga('require', 'displayfeatures');";
83
  $ga_link = "ga('require', 'linkid');";
@@ -92,16 +91,12 @@ function ga_google_analytics_universal() {
92
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
93
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
94
  ga('create', '<?php echo $tracking_id; ?>', 'auto'<?php if ($tracker_object) echo ', '. $tracker_object; ?>);
95
- <?php
96
- if ($custom_code) {
97
- foreach ($custom_code as $c) echo "\t\t\t" . trim($c) . "\n";
98
- }
99
- ?>
100
  <?php
101
- if ($display_ads) echo $ga_display . "\n\t\t\t";
102
- if ($link_attr) echo $ga_link . "\n\t\t\t";
103
- if ($anonymize) echo $ga_anon . "\n\t\t\t";
104
- if ($force_ssl) echo $ga_ssl . "\n\t\t\t";
 
105
  ?>ga('send', 'pageview');
106
  </script>
107
 
@@ -113,8 +108,7 @@ function ga_google_analytics_global() {
113
 
114
  extract(ga_google_analytics_options());
115
 
116
- $custom_code = ga_google_analytics_custom($custom_code);
117
- $custom_code = explode(PHP_EOL, $custom_code);
118
 
119
  ?>
120
 
@@ -123,12 +117,8 @@ function ga_google_analytics_global() {
123
  window.dataLayer = window.dataLayer || [];
124
  function gtag(){dataLayer.push(arguments);}
125
  gtag('js', new Date());
126
- <?php
127
- if ($custom_code) {
128
- foreach ($custom_code as $c) echo "\t\t\t" . trim($c) . "\n";
129
- }
130
- ?>
131
- gtag('config', '<?php echo $tracking_id; ?>'<?php if ($tracker_object) echo ', '. $tracker_object; ?>);
132
  </script>
133
 
134
  <?php
@@ -139,7 +129,7 @@ function ga_google_analytics_legacy() {
139
 
140
  extract(ga_google_analytics_options());
141
 
142
- $custom_code = ga_google_analytics_custom($custom_code);
143
 
144
  $ga_alt = "('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';";
145
  $ga_src = "('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';";
@@ -171,9 +161,21 @@ function ga_google_analytics_legacy() {
171
 
172
  }
173
 
174
- function ga_google_analytics_custom($custom_code) {
 
 
 
 
 
 
 
 
 
 
 
 
175
 
176
- $custom_code = preg_replace("/%%userid%%/i", get_current_user_id(), $custom_code);
177
 
178
  return apply_filters('gap_custom_code', $custom_code);
179
 
76
 
77
  extract(ga_google_analytics_options());
78
 
79
+ $custom_code = ga_google_analytics_custom_code($custom_code);
 
80
 
81
  $ga_display = "ga('require', 'displayfeatures');";
82
  $ga_link = "ga('require', 'linkid');";
91
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
92
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
93
  ga('create', '<?php echo $tracking_id; ?>', 'auto'<?php if ($tracker_object) echo ', '. $tracker_object; ?>);
 
 
 
 
 
94
  <?php
95
+ if ($custom_code) echo $custom_code . "\n\t\t\t";
96
+ if ($display_ads) echo $ga_display . "\n\t\t\t";
97
+ if ($link_attr) echo $ga_link . "\n\t\t\t";
98
+ if ($anonymize) echo $ga_anon . "\n\t\t\t";
99
+ if ($force_ssl) echo $ga_ssl . "\n\t\t\t";
100
  ?>ga('send', 'pageview');
101
  </script>
102
 
108
 
109
  extract(ga_google_analytics_options());
110
 
111
+ $custom_code = ga_google_analytics_custom_code($custom_code);
 
112
 
113
  ?>
114
 
117
  window.dataLayer = window.dataLayer || [];
118
  function gtag(){dataLayer.push(arguments);}
119
  gtag('js', new Date());
120
+ <?php if ($custom_code) echo $custom_code . "\n\t\t\t";
121
+ ?>gtag('config', '<?php echo $tracking_id; ?>'<?php if ($tracker_object) echo ', '. $tracker_object; ?>);
 
 
 
 
122
  </script>
123
 
124
  <?php
129
 
130
  extract(ga_google_analytics_options());
131
 
132
+ $custom_code = ga_google_analytics_custom_code($custom_code);
133
 
134
  $ga_alt = "('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';";
135
  $ga_src = "('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';";
161
 
162
  }
163
 
164
+ function ga_google_analytics_custom_code($custom_code) {
165
+
166
+ $custom_code_array = explode(PHP_EOL, $custom_code);
167
+
168
+ $custom_code = '';
169
+
170
+ foreach ($custom_code_array as $code) {
171
+
172
+ $code = preg_replace("/%%userid%%/i", get_current_user_id(), $code);
173
+
174
+ $custom_code .= "\t\t\t" . trim($code) . "\n";
175
+
176
+ }
177
 
178
+ $custom_code = trim($custom_code);
179
 
180
  return apply_filters('gap_custom_code', $custom_code);
181
 
inc/settings-display.php CHANGED
@@ -206,14 +206,14 @@ if (!function_exists('add_action')) die(); ?>
206
  <td>
207
  <input id="gap_options[gap_custom_loc]" name="gap_options[gap_custom_loc]" type="checkbox" value="1" <?php if (isset($gap_options['gap_custom_loc'])) checked('1', $gap_options['gap_custom_loc']); ?>>
208
  <?php esc_html_e('Display Custom Code', 'ga-google-analytics'); ?> <em><?php esc_html_e('before', 'ga-google-analytics'); ?></em>
209
- <?php esc_html_e('the GA tracking code. Leave unchecked to display', 'ga-google-analytics'); ?> <em><?php esc_html_e('after', 'ga-google-analytics'); ?></em> <?php esc_html_e('the tracking code.', 'ga-google-analytics'); ?>
210
  </td>
211
  </tr>
212
  <tr>
213
  <th><label for="gap_options[admin_area]"><?php esc_html_e('Admin Area', 'ga-google-analytics') ?></label></th>
214
  <td>
215
  <input id="gap_options[admin_area]" name="gap_options[admin_area]" type="checkbox" value="1" <?php if (isset($gap_options['admin_area'])) checked('1', $gap_options['admin_area']); ?>>
216
- <?php esc_html_e('Enable GA tracking in the WordPress Admin Area', 'ga-google-analytics'); ?>
217
  </td>
218
  </tr>
219
  <tr>
206
  <td>
207
  <input id="gap_options[gap_custom_loc]" name="gap_options[gap_custom_loc]" type="checkbox" value="1" <?php if (isset($gap_options['gap_custom_loc'])) checked('1', $gap_options['gap_custom_loc']); ?>>
208
  <?php esc_html_e('Display Custom Code', 'ga-google-analytics'); ?> <em><?php esc_html_e('before', 'ga-google-analytics'); ?></em>
209
+ <?php esc_html_e('the GA tracking code (leave unchecked to display', 'ga-google-analytics'); ?> <em><?php esc_html_e('after', 'ga-google-analytics'); ?></em> <?php esc_html_e('the tracking code)', 'ga-google-analytics'); ?>
210
  </td>
211
  </tr>
212
  <tr>
213
  <th><label for="gap_options[admin_area]"><?php esc_html_e('Admin Area', 'ga-google-analytics') ?></label></th>
214
  <td>
215
  <input id="gap_options[admin_area]" name="gap_options[admin_area]" type="checkbox" value="1" <?php if (isset($gap_options['admin_area'])) checked('1', $gap_options['admin_area']); ?>>
216
+ <?php esc_html_e('Enable tracking in WP Admin Area (adds tracking code only; to view stats log into your Google account)', 'ga-google-analytics'); ?>
217
  </td>
218
  </tr>
219
  <tr>
languages/ga-google-analytics.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: GA Google Analytics\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2019-08-25 16:56+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
9
  "Language-Team: \n"
@@ -352,7 +352,7 @@ msgid "before"
352
  msgstr ""
353
 
354
  #: inc/settings-display.php:209
355
- msgid "the GA tracking code. Leave unchecked to display"
356
  msgstr ""
357
 
358
  #: inc/settings-display.php:209
@@ -360,7 +360,7 @@ msgid "after"
360
  msgstr ""
361
 
362
  #: inc/settings-display.php:209
363
- msgid "the tracking code."
364
  msgstr ""
365
 
366
  #: inc/settings-display.php:213
@@ -368,7 +368,9 @@ msgid "Admin Area"
368
  msgstr ""
369
 
370
  #: inc/settings-display.php:216
371
- msgid "Enable GA tracking in the WordPress Admin Area"
 
 
372
  msgstr ""
373
 
374
  #: inc/settings-display.php:220
3
  msgstr ""
4
  "Project-Id-Version: GA Google Analytics\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2019-11-09 21:39+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
9
  "Language-Team: \n"
352
  msgstr ""
353
 
354
  #: inc/settings-display.php:209
355
+ msgid "the GA tracking code (leave unchecked to display"
356
  msgstr ""
357
 
358
  #: inc/settings-display.php:209
360
  msgstr ""
361
 
362
  #: inc/settings-display.php:209
363
+ msgid "the tracking code)"
364
  msgstr ""
365
 
366
  #: inc/settings-display.php:213
368
  msgstr ""
369
 
370
  #: inc/settings-display.php:216
371
+ msgid ""
372
+ "Enable tracking in WP Admin Area (adds tracking code only; to view stats log "
373
+ "into your Google account)"
374
  msgstr ""
375
 
376
  #: inc/settings-display.php:220
readme.txt CHANGED
@@ -9,9 +9,9 @@ Author URI: https://plugin-planet.com/
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
  Requires at least: 4.1
12
- Tested up to: 5.2
13
- Stable tag: 20190902
14
- Version: 20190902
15
  Requires PHP: 5.6.20
16
  Text Domain: ga-google-analytics
17
  Domain Path: /languages
@@ -265,6 +265,15 @@ If you like GA Google Analytics, please take a moment to [give a 5-star rating](
265
  > New Pro version available! Check out [GA Pro &raquo;](https://plugin-planet.com/ga-google-analytics-pro/)
266
 
267
 
 
 
 
 
 
 
 
 
 
268
  **20190902**
269
 
270
  * Changes order of custom code output
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
  Requires at least: 4.1
12
+ Tested up to: 5.3
13
+ Stable tag: 20191109
14
+ Version: 20191109
15
  Requires PHP: 5.6.20
16
  Text Domain: ga-google-analytics
17
  Domain Path: /languages
265
  > New Pro version available! Check out [GA Pro &raquo;](https://plugin-planet.com/ga-google-analytics-pro/)
266
 
267
 
268
+ **20191109**
269
+
270
+ * Tightens output/display of tracking code
271
+ * Improves sanitization for plugin options
272
+ * Updates styles for plugin settings page
273
+ * Improves clarity of settings page infos
274
+ * Generates new default translation template
275
+ * Tests on WordPress 5.3
276
+
277
  **20190902**
278
 
279
  * Changes order of custom code output