Google Analytics Counter Tracker - Version 3.0.0

Version Description

Download this release

Release Info

Developer Analytics Counter
Plugin Icon 128x128 Google Analytics Counter Tracker
Version 3.0.0
Comparing to
See all releases

Code changes from version 2.0.1 to 3.0.0

analytics-counter.php CHANGED
@@ -3,14 +3,14 @@
3
  Plugin Name: Google Analytics Counter Tracker
4
 
5
  Description: Google analytics counter tracker - analyse the visitors hits on you website and display it graphically
6
- Version: 2.0.1
7
  Author: WPAdm
8
  Author URI: http://www.wpadm.com
9
  Plugin URI: http://www.wpadm.com
10
  License: GPLv2 or later
11
  */
12
 
13
- define( 'WPADM_GA__VIEW_TITLE', 'Analytics Counter');
14
  define( 'WPADM_GA__PLUGIN_NAME', basename(dirname(__FILE__)) );
15
 
16
  define( 'WPADM_GA__MENU_PREFIX', 'wpadm-ga-menu-' );
3
  Plugin Name: Google Analytics Counter Tracker
4
 
5
  Description: Google analytics counter tracker - analyse the visitors hits on you website and display it graphically
6
+ Version: 3.0.0
7
  Author: WPAdm
8
  Author URI: http://www.wpadm.com
9
  Plugin URI: http://www.wpadm.com
10
  License: GPLv2 or later
11
  */
12
 
13
+ define( 'WPADM_GA__VIEW_TITLE', 'Google Analytics Counter');
14
  define( 'WPADM_GA__PLUGIN_NAME', basename(dirname(__FILE__)) );
15
 
16
  define( 'WPADM_GA__MENU_PREFIX', 'wpadm-ga-menu-' );
class.wpadm-ga-options.php CHANGED
@@ -33,7 +33,7 @@ class WPAdm_GA_Options
33
  $this->ga_id = (isset($wpadm_ga['ga_id'])) ? $wpadm_ga['ga_id'] : null;
34
  $this->ga_url = (isset($wpadm_ga['ga_url'])) ? $wpadm_ga['ga_url'] : null;
35
  $this->ga_webPropertyId = (isset($wpadm_ga['ga_webPropertyId'])) ? $wpadm_ga['ga_webPropertyId'] : null;
36
- $this->ga_enableCode = (isset($wpadm_ga['ga_enableCode'])) ? $wpadm_ga['ga_enableCode'] : null;
37
  $this->ga_typeCode = self::TYPE_CODE_UNIVERSAL;
38
  }
39
 
@@ -147,11 +147,6 @@ class WPAdm_GA_Options
147
  return self::getVar('ga_typeCode');
148
  }
149
 
150
-
151
-
152
-
153
-
154
-
155
  protected static function getVar($var) {
156
  if (is_null(self::$instance)) {
157
  self::getInstance();
33
  $this->ga_id = (isset($wpadm_ga['ga_id'])) ? $wpadm_ga['ga_id'] : null;
34
  $this->ga_url = (isset($wpadm_ga['ga_url'])) ? $wpadm_ga['ga_url'] : null;
35
  $this->ga_webPropertyId = (isset($wpadm_ga['ga_webPropertyId'])) ? $wpadm_ga['ga_webPropertyId'] : null;
36
+ $this->ga_enableCode = (isset($wpadm_ga['ga_enableCode'])) ? $wpadm_ga['ga_enableCode'] : 1;
37
  $this->ga_typeCode = self::TYPE_CODE_UNIVERSAL;
38
  }
39
 
147
  return self::getVar('ga_typeCode');
148
  }
149
 
 
 
 
 
 
150
  protected static function getVar($var) {
151
  if (is_null(self::$instance)) {
152
  self::getInstance();
class.wpadm-ga.php CHANGED
@@ -10,6 +10,7 @@ class WPAdm_GA
10
  const REQUEST_PARAM_NAME = 'wpadm_ga_request';
11
 
12
  public static function visitView() {
 
13
 
14
  WPAdm_GA_View::$subtitle = 'Audience Overview';
15
 
@@ -30,6 +31,7 @@ class WPAdm_GA
30
 
31
 
32
  public static function usersView() {
 
33
  WPAdm_GA_View::$subtitle = 'Visitors Overview';
34
 
35
  if($template = self::getErrorTemplate()) {
@@ -46,12 +48,14 @@ class WPAdm_GA
46
  }
47
 
48
  public function sourceView() {
 
49
  WPAdm_GA_View::$subtitle = 'Source stat';
50
  WPAdm_GA_View::$content_file = WPADM_GA__PLUGIN_DIR . 'view' . DIRECTORY_SEPARATOR . 'source.php';
51
  require WPADM_GA__VIEW_LAYOUT;
52
  }
53
 
54
  public function settingsView() {
 
55
  WPAdm_GA_View::$subtitle = 'settings';
56
 
57
  if($template = self::getErrorTemplate()) {
@@ -169,6 +173,20 @@ class WPAdm_GA
169
  require WPADM_GA__VIEW_LAYOUT;
170
  }
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
  static function adminNotice() {
174
 
@@ -351,8 +369,19 @@ public static function registerPluginStyles() {
351
  }
352
 
353
  public static function generateGACodeOnSite() {
354
- if (WPAdm_GA_Options::getGAEnableCode() == 1 && WPAdm_GA_Options::getGAWebPropertyId()) {
 
 
 
 
 
 
 
 
 
 
355
  require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . 'ga_code_universal.php';
 
356
  }
357
  }
358
 
@@ -365,6 +394,7 @@ public static function registerPluginStyles() {
365
 
366
  $token = WPAdm_GA_Options::getGAAccessToken();
367
  if (empty($token)) {
 
368
  return WPAdm_GA_View::$content_file = WPADM_GA__PLUGIN_DIR . 'view' . DIRECTORY_SEPARATOR . 'error_admin_empty_ga_token.php';
369
  }
370
 
10
  const REQUEST_PARAM_NAME = 'wpadm_ga_request';
11
 
12
  public static function visitView() {
13
+ self::processingPostRequest();
14
 
15
  WPAdm_GA_View::$subtitle = 'Audience Overview';
16
 
31
 
32
 
33
  public static function usersView() {
34
+ self::processingPostRequest();
35
  WPAdm_GA_View::$subtitle = 'Visitors Overview';
36
 
37
  if($template = self::getErrorTemplate()) {
48
  }
49
 
50
  public function sourceView() {
51
+ self::processingPostRequest();
52
  WPAdm_GA_View::$subtitle = 'Source stat';
53
  WPAdm_GA_View::$content_file = WPADM_GA__PLUGIN_DIR . 'view' . DIRECTORY_SEPARATOR . 'source.php';
54
  require WPADM_GA__VIEW_LAYOUT;
55
  }
56
 
57
  public function settingsView() {
58
+ self::processingPostRequest();
59
  WPAdm_GA_View::$subtitle = 'settings';
60
 
61
  if($template = self::getErrorTemplate()) {
173
  require WPADM_GA__VIEW_LAYOUT;
174
  }
175
 
176
+ public static function processingPostRequest()
177
+ {
178
+ if ('POST' == strtoupper($_SERVER['REQUEST_METHOD'])
179
+ && isset($_POST['wpadm_ga_manual_tracking_code'])
180
+ ) {
181
+ $code = trim($_POST['wpadm_ga_manual_tracking_code']);
182
+ if ($code) {
183
+ update_option('wpadm_ga_manual_tracking_code', $code);
184
+ } else {
185
+ delete_option('wpadm_ga_manual_tracking_code');
186
+ }
187
+ }
188
+ }
189
+
190
 
191
  static function adminNotice() {
192
 
369
  }
370
 
371
  public static function generateGACodeOnSite() {
372
+ $token = WPAdm_GA_Options::getGAAccessToken();
373
+ if (empty($token)) {
374
+ $code = get_option('wpadm_ga_manual_tracking_code');
375
+ if ($code) {
376
+ echo '<!-- '.WPADM_GA__PLUGIN_NAME.' google analytics manual tracking code -->';
377
+ echo stripslashes($code);
378
+ echo '<!-- -->';
379
+ }
380
+
381
+ } elseif (WPAdm_GA_Options::getGAEnableCode() == 1 && WPAdm_GA_Options::getGAWebPropertyId()) {
382
+ echo '<!-- '.WPADM_GA__PLUGIN_NAME.' google analytics tracking code -->';
383
  require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . 'ga_code_universal.php';
384
+ echo '<!-- -->';
385
  }
386
  }
387
 
394
 
395
  $token = WPAdm_GA_Options::getGAAccessToken();
396
  if (empty($token)) {
397
+ WPAdm_GA_View::$subtitle = 'Account Connection';
398
  return WPAdm_GA_View::$content_file = WPADM_GA__PLUGIN_DIR . 'view' . DIRECTORY_SEPARATOR . 'error_admin_empty_ga_token.php';
399
  }
400
 
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
  === Google Analytics Counter Tracker ===
2
  Plugin Name: Google Analytics Counter Tracker
3
- Version: 2.0.1
4
  Tags: Google Analytics, Analytics, Statistics, Analytics dashboard, Reports, Charts, Stats, Web stats, Visit, Audience Overview, Visitors Overview, Marketing, Google, Keywords, Counter, Tracker, Hit counter, hitcounter, visitor tracker, visitor tracking, visitors, tracking, stats, statscounter, analyse, hits, hit, track
5
  Requires at least: 3.9
6
  Tested up to: 4.4
@@ -77,8 +77,8 @@ If you need help with the Google Analytics Counter Tracker plugin or you want to
77
 
78
  The new improved version of Analytics Counter plugin is now online.<br />
79
 
80
- = Google Analytics Counter Tracker version 3.0.0 coming soon for WordPress users. =
81
- * this version coming soon
82
 
83
  = Google Analytics Counter Tracker version 2.0.1 is now online and available for WordPress users. =
84
  * Small fixes
1
  === Google Analytics Counter Tracker ===
2
  Plugin Name: Google Analytics Counter Tracker
3
+ Version: 3.0.0
4
  Tags: Google Analytics, Analytics, Statistics, Analytics dashboard, Reports, Charts, Stats, Web stats, Visit, Audience Overview, Visitors Overview, Marketing, Google, Keywords, Counter, Tracker, Hit counter, hitcounter, visitor tracker, visitor tracking, visitors, tracking, stats, statscounter, analyse, hits, hit, track
5
  Requires at least: 3.9
6
  Tested up to: 4.4
77
 
78
  The new improved version of Analytics Counter plugin is now online.<br />
79
 
80
+ = Google Analytics Counter Tracker version 3.0.0 for WordPress users. =
81
+ * Integrate Google Analytics tracking code without to connect to google analytics account
82
 
83
  = Google Analytics Counter Tracker version 2.0.1 is now online and available for WordPress users. =
84
  * Small fixes
view/error_admin_empty_ga_token.php CHANGED
@@ -1,3 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  $current_uri = home_url( add_query_arg( NULL, NULL ) );
3
  ?>
@@ -11,7 +52,69 @@ $current_uri = home_url( add_query_arg( NULL, NULL ) );
11
  <p>Since Google Analytics account was successfully created, please, connect the Google Analytics created account to this Google Analytics plugin, using the same access credentials data.</p>
12
 
13
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
 
 
 
 
 
 
15
  </div>
16
 
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style type="text/css">
2
+ .wpadm_ga_code_tab_btn, .wpadm_ga_code_tab_btn_active {
3
+ padding: 10px;
4
+ text-align: center;
5
+ cursor: pointer;
6
+ font-weight: bold;
7
+ background-color: #f9f9f9;
8
+ color: gray;
9
+ border: 1px solid #b4b4b4;
10
+ }
11
+
12
+ .wpadm_ga_code_tab_btn_active {
13
+ background-color: #EDEDED;
14
+ color: black;
15
+ }
16
+
17
+ .wpadm_ga_code_tab {
18
+ padding: 20px;
19
+ background-color: #EDEDED;
20
+ border: 1px solid #b4b4b4;
21
+ border-top: none;
22
+ }
23
+
24
+ #wpadm_ga_manual_tracking_code {
25
+ border: 1px solid #b4b4b4;
26
+ color: black;
27
+ }
28
+
29
+ #wpadm_ga_submit_code_btn {
30
+ background-color: #9acfea;
31
+ }
32
+
33
+ #wpadm_ga_submit_code_btn:hover {
34
+ background-color: #0088cc;
35
+ color: white;
36
+ }
37
+
38
+
39
+
40
+ </style>
41
+
42
  <?php
43
  $current_uri = home_url( add_query_arg( NULL, NULL ) );
44
  ?>
52
  <p>Since Google Analytics account was successfully created, please, connect the Google Analytics created account to this Google Analytics plugin, using the same access credentials data.</p>
53
 
54
  </div>
55
+ </div>
56
+
57
+ <div class="row" style="margin-top: 100px; ">
58
+ <div class="col-md-8">
59
+ <div class="wpadm_ga_code_tab_btn_active" style=" float: left; width: 50%;" id="wpadm_ga_tab_auto_btn" onclick="wpadm_ga_clickToTab('auto')">
60
+ Automatically generate Google Analytics Code
61
+ </div>
62
+ <div class="wpadm_ga_code_tab_btn" id="wpadm_ga_tab_manual_btn" onclick="wpadm_ga_clickToTab('manual')">
63
+ Manually past Google Analytics Code
64
+ </div>
65
+ </div>
66
+ </div>
67
+ <div class="row" id="wpadm_ga_manual_code_container">
68
+ <div class="col-md-8">
69
+ <div class="wpadm_ga_code_tab" id="wpadm_ga_tab_auto">
70
+ <p style="text-align: center">
71
+ Click here to <?php echo '<a href="'.WPAdm_GA::URL_GA_AUTH.'?fix"">connect your Google Analytics account</a>'; ?>,
72
+ automatically generate Google Analytics code <br>and automatically past Google Analytics code in your website.
73
+ </p>
74
+ </div>
75
+ <div class="wpadm_ga_code_tab" style="display: none;" id="wpadm_ga_tab_manual">
76
+ <form method="post">
77
+ <p>Manually past Google Analytics сode in HTML of your website, without to connect to Google Analytics services. More information about this you can read on <a href="https://support.google.com/analytics/answer/1008080">Google Analytics support</a> pages.
78
+ </p><p>Please, past your Google Analytics code here:</p>
79
+ <?php
80
+ $code = get_option('wpadm_ga_manual_tracking_code', '');
81
+ ?>
82
+
83
+ <textarea class="form-control" rows="5" name="wpadm_ga_manual_tracking_code" id="wpadm_ga_manual_tracking_code"><?php echo stripslashes($code); ?></textarea>
84
 
85
+ <div style="text-align: right; margin-top: 10px;">
86
+ <input type="submit" id="wpadm_ga_submit_code_btn" value="Save and integrate Google Analytics code" class="btn btn-default">
87
+ </div>
88
+ </form>
89
+ </div>
90
+ </div>
91
  </div>
92
 
93
 
94
+ <script type="text/javascript">
95
+ function wpadm_ga_clickToTab(tab) {
96
+ var auto_btn = document.getElementById('wpadm_ga_tab_auto_btn');
97
+ var manual_btn = document.getElementById('wpadm_ga_tab_manual_btn');
98
+
99
+ var auto_cont = document.getElementById('wpadm_ga_tab_auto');
100
+ var manual_cont = document.getElementById('wpadm_ga_tab_manual');
101
+
102
+ if (tab == 'manual') {
103
+ manual_btn.className = 'wpadm_ga_code_tab_btn_active';
104
+ auto_btn.className = 'wpadm_ga_code_tab_btn';
105
+ auto_cont.style.display = 'none';
106
+ manual_cont.style.display = '';
107
+ } else {
108
+ manual_btn.className = 'wpadm_ga_code_tab_btn';
109
+ auto_btn.className = 'wpadm_ga_code_tab_btn_active';
110
+ auto_cont.style.display = '';
111
+ manual_cont.style.display = 'none';
112
+ }
113
+ }
114
+ <?php
115
+ if($code) {
116
+ echo 'wpadm_ga_clickToTab("manual")';
117
+ }
118
+ ?>
119
+
120
+ </script>