Version Description
- Display Advertising feature added.
- IP Anonymization option is now available.
Download this release
Release Info
Developer | audriusd |
Plugin | Google Universal Analytics |
Version | 2.2 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.2
- assets/gua-main.js +24 -0
- classic/classic-analytics.php +1 -1
- classic/custom-analytics.php +1 -1
- googleanalytics.php +594 -291
- options.php +87 -73
- readme.txt +10 -3
- tracking-code.php +87 -39
assets/gua-main.js
CHANGED
@@ -69,6 +69,26 @@ jQuery(document).ready(function(e) {
|
|
69 |
var track_links = 'off';
|
70 |
|
71 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
if(jQuery('#tracking_off_for_role').is(':checked')){
|
74 |
|
@@ -107,6 +127,10 @@ jQuery(document).ready(function(e) {
|
|
107 |
'property_id' : property_id,
|
108 |
|
109 |
'track_links' : track_links,
|
|
|
|
|
|
|
|
|
110 |
|
111 |
'tracking_off_for_role' : tracking_off_for_role,
|
112 |
|
69 |
var track_links = 'off';
|
70 |
|
71 |
}
|
72 |
+
|
73 |
+
if(jQuery('#enable_display').is(':checked')){
|
74 |
+
|
75 |
+
var enable_display = 'on';
|
76 |
+
|
77 |
+
}else{
|
78 |
+
|
79 |
+
var enable_display = 'off';
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
if(jQuery('#anonymize_ip').is(':checked')){
|
84 |
+
|
85 |
+
var anonymize_ip = 'on';
|
86 |
+
|
87 |
+
}else{
|
88 |
+
|
89 |
+
var anonymize_ip = 'off';
|
90 |
+
|
91 |
+
}
|
92 |
|
93 |
if(jQuery('#tracking_off_for_role').is(':checked')){
|
94 |
|
127 |
'property_id' : property_id,
|
128 |
|
129 |
'track_links' : track_links,
|
130 |
+
|
131 |
+
'enable_display' : enable_display,
|
132 |
+
|
133 |
+
'anonymize_ip' : anonymize_ip,
|
134 |
|
135 |
'tracking_off_for_role' : tracking_off_for_role,
|
136 |
|
classic/classic-analytics.php
CHANGED
@@ -57,6 +57,6 @@
|
|
57 |
</form>
|
58 |
</div>
|
59 |
<div class="clearfix"></div>
|
60 |
-
<div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.
|
61 |
</div>
|
62 |
</br>
|
57 |
</form>
|
58 |
</div>
|
59 |
<div class="clearfix"></div>
|
60 |
+
<div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.2&utm_content=Google%20Classic%20Analytics&utm_campaign=WordPress%20plugins" title="Google Universal Analytics">OnlineAds.lt</a> </div>
|
61 |
</div>
|
62 |
</br>
|
classic/custom-analytics.php
CHANGED
@@ -57,6 +57,6 @@
|
|
57 |
</form>
|
58 |
</div>
|
59 |
<div class="clearfix"></div>
|
60 |
-
<div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.
|
61 |
</div>
|
62 |
</br>
|
57 |
</form>
|
58 |
</div>
|
59 |
<div class="clearfix"></div>
|
60 |
+
<div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.2&utm_content=Google%20Custom%20Analytics&utm_campaign=WordPress%20plugins">OnlineAds.lt</a> </div>
|
61 |
</div>
|
62 |
</br>
|
googleanalytics.php
CHANGED
@@ -1,292 +1,595 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
(
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
function
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
$
|
270 |
-
|
271 |
-
$
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
add_action(
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
|
5 |
+
Plugin Name: Google Universal Analytics
|
6 |
+
|
7 |
+
Plugin URI: http://wordpress.org/extend/plugins/google-universal-analytics/
|
8 |
+
|
9 |
+
Description: Adds <a href="http://www.google.com/analytics/">Google Analytics</a> tracking code on all pages.
|
10 |
+
|
11 |
+
Version: 2.2
|
12 |
+
|
13 |
+
Author: Audrius Dobilinskas
|
14 |
+
|
15 |
+
Author URI: http://onlineads.lt/
|
16 |
+
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
if (!defined('WP_CONTENT_URL'))
|
22 |
+
|
23 |
+
define('WP_CONTENT_URL', get_option('siteurl').'/wp-content');
|
24 |
+
|
25 |
+
if (!defined('WP_CONTENT_DIR'))
|
26 |
+
|
27 |
+
define('WP_CONTENT_DIR', ABSPATH.'wp-content');
|
28 |
+
|
29 |
+
if (!defined('WP_PLUGIN_URL'))
|
30 |
+
|
31 |
+
define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins');
|
32 |
+
|
33 |
+
if (!defined('WP_PLUGIN_DIR'))
|
34 |
+
|
35 |
+
define('WP_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins');
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
function deactive_google_universal_analytics() {
|
40 |
+
|
41 |
+
delete_option('web_property_id');
|
42 |
+
|
43 |
+
delete_option('in_footer');
|
44 |
+
|
45 |
+
delete_option('plugin_switch');
|
46 |
+
|
47 |
+
delete_option('track_links');
|
48 |
+
|
49 |
+
delete_option('enable_display');
|
50 |
+
|
51 |
+
delete_option('anonymize_ip');
|
52 |
+
|
53 |
+
delete_option('tracking_off_for_this_role');
|
54 |
+
|
55 |
+
delete_option('tracking_off_for_role');
|
56 |
+
|
57 |
+
//classic_options
|
58 |
+
|
59 |
+
delete_option('classic_property_id');
|
60 |
+
|
61 |
+
delete_option('classic_in_footer');
|
62 |
+
|
63 |
+
delete_option('classic_plugin_switch');
|
64 |
+
|
65 |
+
delete_option('classic_tracking_off_for_role');
|
66 |
+
|
67 |
+
delete_option('classic_tracking_off_for_this_role');
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
//custom_options
|
72 |
+
|
73 |
+
delete_option('custom_in_footer');
|
74 |
+
|
75 |
+
delete_option('custom_plugin_switch');
|
76 |
+
|
77 |
+
delete_option('custom_web_property_id');
|
78 |
+
|
79 |
+
delete_option('custom_tracking_off_for_role');
|
80 |
+
|
81 |
+
delete_option('custom_tracking_off_for_this_role');
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
function admin_menu_google_universal_analytics() {
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
+
global $settings_page, $settings_page1, $classic_page, $cutom_page;
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
$settings_page = add_menu_page( 'Google Universal Analytics', 'Google Universal Analytics', 'manage_options', 'google_universal_analytics', 'options_page_google_universal_analytics' );
|
100 |
+
|
101 |
+
add_submenu_page('google_universal_analytics','','','manage_options','google_universal_analytics','options_page_google_universal_analytics');
|
102 |
+
|
103 |
+
$settings_page1 = add_submenu_page( 'google_universal_analytics', 'Universal Analytics', 'Universal Analytics', 'manage_options', 'google_universal_analytics', 'options_page_google_universal_analytics' );
|
104 |
+
|
105 |
+
$classic_page = add_submenu_page( 'google_universal_analytics', 'Classic Analytics', 'Classic Analytics', 'manage_options', 'classic_analytics', 'classic_analytics_page_google_universal_analytics' );
|
106 |
+
|
107 |
+
|
108 |
+
|
109 |
+
$cutom_page = add_submenu_page( 'google_universal_analytics', 'Custom Tracker', 'Custom Tracker', 'manage_options', 'custom_analytics', 'custom_analytics_page_google_universal_analytics' );
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
|
117 |
+
function options_page_google_universal_analytics() {
|
118 |
+
|
119 |
+
include(WP_PLUGIN_DIR.'/google-universal-analytics/options.php');
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
function classic_analytics_page_google_universal_analytics() {
|
124 |
+
|
125 |
+
include(WP_PLUGIN_DIR.'/google-universal-analytics/classic/classic-analytics.php');
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
function custom_analytics_page_google_universal_analytics() {
|
130 |
+
|
131 |
+
include(WP_PLUGIN_DIR.'/google-universal-analytics/classic/custom-analytics.php');
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
|
136 |
+
|
137 |
+
function google_universal_analytics() {
|
138 |
+
|
139 |
+
require 'tracking-code.php';
|
140 |
+
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
|
145 |
+
function google_classic_analytics() {
|
146 |
+
|
147 |
+
$classic_property_id = get_option('classic_property_id');
|
148 |
+
|
149 |
+
$classic_analytics_code = "<script type='text/javascript'>
|
150 |
+
|
151 |
+
|
152 |
+
|
153 |
+
var _gaq = _gaq || [];
|
154 |
+
|
155 |
+
_gaq.push(['_setAccount', '$classic_property_id']);
|
156 |
+
|
157 |
+
_gaq.push(['_trackPageview']);
|
158 |
+
|
159 |
+
|
160 |
+
|
161 |
+
(function() {
|
162 |
+
|
163 |
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
164 |
+
|
165 |
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
166 |
+
|
167 |
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
168 |
+
|
169 |
+
})();
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
</script>";
|
174 |
+
|
175 |
+
echo $classic_analytics_code;
|
176 |
+
|
177 |
+
}
|
178 |
+
|
179 |
+
function google_custom_analytics() {
|
180 |
+
|
181 |
+
echo get_option('custom_web_property_id');
|
182 |
+
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
|
187 |
+
function google_universal_analytics_scripts($hook){
|
188 |
+
|
189 |
+
global $settings_page, $settings_page1, $classic_page, $cutom_page;
|
190 |
+
|
191 |
+
|
192 |
+
|
193 |
+
if($hook != $settings_page && $hook != $settings_page1 && $hook != $classic_page && $hook != $cutom_page )
|
194 |
+
|
195 |
+
return;
|
196 |
+
|
197 |
+
|
198 |
+
|
199 |
+
//register styles
|
200 |
+
|
201 |
+
wp_register_style( 'bootstrap-css', plugins_url( 'google-universal-analytics/bootstrap/css/bootstrap.min.css' , dirname(__FILE__) ) );
|
202 |
+
|
203 |
+
wp_register_style( 'bootstrap-switch-css', plugins_url( 'google-universal-analytics/bootstrap/css/bootstrap-switch.min.css' , dirname(__FILE__) ) );
|
204 |
+
|
205 |
+
wp_register_style( 'main-css', plugins_url( 'google-universal-analytics/assets/gua-main.css' , dirname(__FILE__) ) );
|
206 |
+
|
207 |
+
|
208 |
+
|
209 |
+
//register scripts
|
210 |
+
|
211 |
+
wp_register_script( 'google-js', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', array(), '', true );
|
212 |
+
|
213 |
+
wp_register_script( 'bootstrap-js', plugins_url( 'google-universal-analytics/bootstrap/js/bootstrap.min.js' , dirname(__FILE__) ), array('google-js'), '', true );
|
214 |
+
|
215 |
+
wp_register_script( 'bootstrap-switch-js', plugins_url( 'google-universal-analytics/bootstrap/js/bootstrap-switch.min.js' , dirname(__FILE__) ) , array('bootstrap-js'),'',true );
|
216 |
+
|
217 |
+
wp_register_script( 'main-js', plugins_url( 'google-universal-analytics/assets/gua-main.js' , dirname(__FILE__) ) , array('google-js'),'',true );
|
218 |
+
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
|
223 |
+
//enqueue styles
|
224 |
+
|
225 |
+
wp_enqueue_style( 'bootstrap-css' );
|
226 |
+
|
227 |
+
wp_enqueue_style( 'bootstrap-switch-css' );
|
228 |
+
|
229 |
+
wp_enqueue_style( 'main-css' );
|
230 |
+
|
231 |
+
|
232 |
+
|
233 |
+
//enqueue scripts
|
234 |
+
|
235 |
+
wp_enqueue_script( 'google-js' );
|
236 |
+
|
237 |
+
wp_enqueue_script( 'bootstrap-js' );
|
238 |
+
|
239 |
+
wp_enqueue_script( 'bootstrap-switch-js' );
|
240 |
+
|
241 |
+
wp_enqueue_script( 'main-js' );
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
|
246 |
+
|
247 |
+
|
248 |
+
|
249 |
+
register_deactivation_hook(__FILE__, 'deactive_google_universal_analytics');
|
250 |
+
|
251 |
+
|
252 |
+
|
253 |
+
if (is_admin()) {
|
254 |
+
|
255 |
+
add_action('admin_enqueue_scripts', 'google_universal_analytics_scripts');
|
256 |
+
|
257 |
+
add_action('admin_menu', 'admin_menu_google_universal_analytics');
|
258 |
+
|
259 |
+
}
|
260 |
+
|
261 |
+
|
262 |
+
|
263 |
+
add_action('init', 'display_google_universal_analytics_code');
|
264 |
+
|
265 |
+
function display_google_universal_analytics_code(){
|
266 |
+
|
267 |
+
global $current_user;
|
268 |
+
|
269 |
+
$user_roles = $current_user->roles;
|
270 |
+
|
271 |
+
$user_role = array_shift($user_roles);
|
272 |
+
|
273 |
+
|
274 |
+
|
275 |
+
|
276 |
+
|
277 |
+
if(get_option('tracking_off_for_role')=='on' && strcasecmp($user_role , get_option('tracking_off_for_this_role'))!=0){
|
278 |
+
|
279 |
+
if (!is_admin() && get_option('plugin_switch')=='on') {
|
280 |
+
|
281 |
+
if(get_option('in_footer')=='on'){
|
282 |
+
|
283 |
+
add_action('wp_footer', 'google_universal_analytics');
|
284 |
+
|
285 |
+
}else{
|
286 |
+
|
287 |
+
add_action('wp_head', 'google_universal_analytics');
|
288 |
+
|
289 |
+
}
|
290 |
+
|
291 |
+
}
|
292 |
+
|
293 |
+
}elseif(is_user_logged_in() && get_option('tracking_off_for_role')!='on'){
|
294 |
+
|
295 |
+
if (!is_admin() && get_option('plugin_switch')=='on') {
|
296 |
+
|
297 |
+
if(get_option('in_footer')=='on'){
|
298 |
+
|
299 |
+
add_action('wp_footer', 'google_universal_analytics');
|
300 |
+
|
301 |
+
}else{
|
302 |
+
|
303 |
+
add_action('wp_head', 'google_universal_analytics');
|
304 |
+
|
305 |
+
}
|
306 |
+
|
307 |
+
}
|
308 |
+
|
309 |
+
|
310 |
+
|
311 |
+
}elseif(!is_user_logged_in()){
|
312 |
+
|
313 |
+
if (!is_admin() && get_option('plugin_switch')=='on') {
|
314 |
+
|
315 |
+
if(get_option('in_footer')=='on'){
|
316 |
+
|
317 |
+
add_action('wp_footer', 'google_universal_analytics');
|
318 |
+
|
319 |
+
}else{
|
320 |
+
|
321 |
+
add_action('wp_head', 'google_universal_analytics');
|
322 |
+
|
323 |
+
}
|
324 |
+
|
325 |
+
}
|
326 |
+
|
327 |
+
|
328 |
+
|
329 |
+
}
|
330 |
+
|
331 |
+
|
332 |
+
|
333 |
+
|
334 |
+
|
335 |
+
if(get_option('custom_tracking_off_for_role')=='on' && strcasecmp($user_role , get_option('custom_tracking_off_for_this_role'))!=0){
|
336 |
+
|
337 |
+
if (!is_admin() && get_option('custom_plugin_switch')=='on') {
|
338 |
+
|
339 |
+
if(get_option('custom_in_footer')=='on'){
|
340 |
+
|
341 |
+
add_action('wp_footer', 'google_custom_analytics');
|
342 |
+
|
343 |
+
}else{
|
344 |
+
|
345 |
+
add_action('wp_head', 'google_custom_analytics');
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
}
|
350 |
+
|
351 |
+
}elseif(is_user_logged_in() && get_option('custom_tracking_off_for_role')!='on'){
|
352 |
+
|
353 |
+
if (!is_admin() && get_option('custom_plugin_switch')=='on') {
|
354 |
+
|
355 |
+
if(get_option('custom_in_footer')=='on'){
|
356 |
+
|
357 |
+
add_action('wp_footer', 'google_custom_analytics');
|
358 |
+
|
359 |
+
}else{
|
360 |
+
|
361 |
+
add_action('wp_head', 'google_custom_analytics');
|
362 |
+
|
363 |
+
}
|
364 |
+
|
365 |
+
}
|
366 |
+
|
367 |
+
|
368 |
+
|
369 |
+
}elseif(!is_user_logged_in()){
|
370 |
+
|
371 |
+
if (!is_admin() && get_option('custom_plugin_switch')=='on') {
|
372 |
+
|
373 |
+
if(get_option('custom_in_footer')=='on'){
|
374 |
+
|
375 |
+
add_action('wp_footer', 'google_custom_analytics');
|
376 |
+
|
377 |
+
}else{
|
378 |
+
|
379 |
+
add_action('wp_head', 'google_custom_analytics');
|
380 |
+
|
381 |
+
}
|
382 |
+
|
383 |
+
}
|
384 |
+
|
385 |
+
|
386 |
+
|
387 |
+
}
|
388 |
+
|
389 |
+
|
390 |
+
|
391 |
+
if(get_option('classic_tracking_off_for_role')=='on' && strcasecmp($user_role , get_option('classic_tracking_off_for_this_role'))!=0){
|
392 |
+
|
393 |
+
if (!is_admin() && get_option('classic_plugin_switch')=='on') {
|
394 |
+
|
395 |
+
if(get_option('classic_in_footer')=='on'){
|
396 |
+
|
397 |
+
add_action('wp_footer', 'google_classic_analytics');
|
398 |
+
|
399 |
+
}else{
|
400 |
+
|
401 |
+
add_action('wp_head', 'google_classic_analytics');
|
402 |
+
|
403 |
+
}
|
404 |
+
|
405 |
+
}
|
406 |
+
|
407 |
+
}elseif(is_user_logged_in() && get_option('classic_tracking_off_for_role')!='on'){
|
408 |
+
|
409 |
+
if (!is_admin() && get_option('classic_plugin_switch')=='on') {
|
410 |
+
|
411 |
+
if(get_option('classic_in_footer')=='on'){
|
412 |
+
|
413 |
+
add_action('wp_footer', 'google_classic_analytics');
|
414 |
+
|
415 |
+
}else{
|
416 |
+
|
417 |
+
add_action('wp_head', 'google_classic_analytics');
|
418 |
+
|
419 |
+
}
|
420 |
+
|
421 |
+
}
|
422 |
+
|
423 |
+
}elseif(!is_user_logged_in()){
|
424 |
+
|
425 |
+
if (!is_admin() && get_option('classic_plugin_switch')=='on') {
|
426 |
+
|
427 |
+
if(get_option('classic_in_footer')=='on'){
|
428 |
+
|
429 |
+
add_action('wp_footer', 'google_classic_analytics');
|
430 |
+
|
431 |
+
}else{
|
432 |
+
|
433 |
+
add_action('wp_head', 'google_classic_analytics');
|
434 |
+
|
435 |
+
}
|
436 |
+
|
437 |
+
}
|
438 |
+
|
439 |
+
}
|
440 |
+
|
441 |
+
|
442 |
+
|
443 |
+
}
|
444 |
+
|
445 |
+
|
446 |
+
|
447 |
+
|
448 |
+
|
449 |
+
|
450 |
+
|
451 |
+
function save_google_universal_analytics_settings() {
|
452 |
+
|
453 |
+
// The $_REQUEST contains all the data sent via ajax
|
454 |
+
|
455 |
+
if ( isset($_REQUEST) ) {
|
456 |
+
|
457 |
+
$property_id = $_REQUEST['property_id'];
|
458 |
+
|
459 |
+
$in_footer = $_REQUEST['in_footer'];
|
460 |
+
|
461 |
+
$plugin_switch = $_REQUEST['plugin_switch'];
|
462 |
+
|
463 |
+
$track_links = $_REQUEST['track_links'];
|
464 |
+
|
465 |
+
$enable_display = $_REQUEST['enable_display'];
|
466 |
+
|
467 |
+
$anonymize_ip = $_REQUEST['anonymize_ip'];
|
468 |
+
|
469 |
+
$tracking_off_for_this_role = $_REQUEST['tracking_off_for_this_role'];
|
470 |
+
|
471 |
+
$tracking_off_for_role = $_REQUEST['tracking_off_for_role'];
|
472 |
+
|
473 |
+
|
474 |
+
|
475 |
+
|
476 |
+
|
477 |
+
update_option('web_property_id', $property_id);
|
478 |
+
|
479 |
+
update_option('in_footer', $in_footer);
|
480 |
+
|
481 |
+
update_option('plugin_switch', $plugin_switch);
|
482 |
+
|
483 |
+
update_option('track_links', $track_links);
|
484 |
+
|
485 |
+
update_option('enable_display', $enable_display);
|
486 |
+
|
487 |
+
update_option('anonymize_ip', $anonymize_ip);
|
488 |
+
|
489 |
+
update_option('tracking_off_for_this_role', $tracking_off_for_this_role);
|
490 |
+
|
491 |
+
update_option('tracking_off_for_role', $tracking_off_for_role);
|
492 |
+
|
493 |
+
}
|
494 |
+
|
495 |
+
// Always die in functions echoing ajax content
|
496 |
+
|
497 |
+
die();
|
498 |
+
|
499 |
+
}
|
500 |
+
|
501 |
+
|
502 |
+
|
503 |
+
function save_google_classic_analytics_settings() {
|
504 |
+
|
505 |
+
// The $_REQUEST contains all the data sent via ajax
|
506 |
+
|
507 |
+
if ( isset($_REQUEST) ) {
|
508 |
+
|
509 |
+
$classic_property_id = $_REQUEST['classic_property_id'];
|
510 |
+
|
511 |
+
$classic_in_footer = $_REQUEST['classic_in_footer'];
|
512 |
+
|
513 |
+
$classic_plugin_switch = $_REQUEST['classic_plugin_switch'];
|
514 |
+
|
515 |
+
$classic_tracking_off_for_role = $_REQUEST['classic_tracking_off_for_role'];
|
516 |
+
|
517 |
+
$classic_tracking_off_for_this_role = $_REQUEST['classic_tracking_off_for_this_role'];
|
518 |
+
|
519 |
+
|
520 |
+
|
521 |
+
|
522 |
+
|
523 |
+
update_option('classic_property_id', $classic_property_id);
|
524 |
+
|
525 |
+
update_option('classic_in_footer', $classic_in_footer);
|
526 |
+
|
527 |
+
update_option('classic_plugin_switch', $classic_plugin_switch);
|
528 |
+
|
529 |
+
update_option('classic_tracking_off_for_role', $classic_tracking_off_for_role);
|
530 |
+
|
531 |
+
update_option('classic_tracking_off_for_this_role', $classic_tracking_off_for_this_role);
|
532 |
+
|
533 |
+
}
|
534 |
+
|
535 |
+
// Always die in functions echoing ajax content
|
536 |
+
|
537 |
+
die();
|
538 |
+
|
539 |
+
}
|
540 |
+
|
541 |
+
function save_google_custom_analytics_settings() {
|
542 |
+
|
543 |
+
// The $_REQUEST contains all the data sent via ajax
|
544 |
+
|
545 |
+
if ( isset($_REQUEST) ) {
|
546 |
+
|
547 |
+
$custom_in_footer = $_REQUEST['custom_in_footer'];
|
548 |
+
|
549 |
+
$custom_plugin_switch = $_REQUEST['custom_plugin_switch'];
|
550 |
+
|
551 |
+
$custom_web_property_id = $_REQUEST['custom_web_property_id'];
|
552 |
+
|
553 |
+
$custom_web_property_id = stripslashes($custom_web_property_id);
|
554 |
+
|
555 |
+
$custom_tracking_off_for_role = $_REQUEST['custom_tracking_off_for_role'];
|
556 |
+
|
557 |
+
$custom_tracking_off_for_this_role = $_REQUEST['custom_tracking_off_for_this_role'];
|
558 |
+
|
559 |
+
|
560 |
+
|
561 |
+
|
562 |
+
|
563 |
+
update_option('custom_in_footer', $custom_in_footer);
|
564 |
+
|
565 |
+
update_option('custom_plugin_switch', $custom_plugin_switch);
|
566 |
+
|
567 |
+
update_option('custom_web_property_id', $custom_web_property_id);
|
568 |
+
|
569 |
+
update_option('custom_tracking_off_for_role', $custom_tracking_off_for_role);
|
570 |
+
|
571 |
+
update_option('custom_tracking_off_for_this_role', $custom_tracking_off_for_this_role);
|
572 |
+
|
573 |
+
}
|
574 |
+
|
575 |
+
// Always die in functions echoing ajax content
|
576 |
+
|
577 |
+
die();
|
578 |
+
|
579 |
+
}
|
580 |
+
|
581 |
+
|
582 |
+
|
583 |
+
|
584 |
+
|
585 |
+
add_action( 'wp_ajax_save_google_universal_analytics_settings', 'save_google_universal_analytics_settings' );
|
586 |
+
|
587 |
+
add_action( 'wp_ajax_save_google_classic_analytics_settings', 'save_google_classic_analytics_settings' );
|
588 |
+
|
589 |
+
add_action( 'wp_ajax_save_google_custom_analytics_settings', 'save_google_custom_analytics_settings' );
|
590 |
+
|
591 |
+
|
592 |
+
|
593 |
+
|
594 |
+
|
595 |
?>
|
options.php
CHANGED
@@ -1,73 +1,87 @@
|
|
1 |
-
<div class="wrap">
|
2 |
-
<h2>Google Universal Analytics</h2>
|
3 |
-
|
4 |
-
<
|
5 |
-
|
6 |
-
<
|
7 |
-
|
8 |
-
<div class="
|
9 |
-
<
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
<
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
<div class="
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
<div class="
|
64 |
-
<
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
</
|
73 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h2>Google Universal Analytics</h2>
|
3 |
+
<br />
|
4 |
+
<div class="col-lg-6 row">
|
5 |
+
<form class="form-horizontal" role="form" id="google-universal-options">
|
6 |
+
<div class="form-group">
|
7 |
+
<label for="web_property_id" class="col-sm-3 control-label">Status</label>
|
8 |
+
<div class="col-sm-9">
|
9 |
+
<input id="plugin_switch" type="checkbox" name="plugin_switch" <?php if(get_option('plugin_switch')=='on'): ?> checked="checked" <?php endif; ?>>
|
10 |
+
</div>
|
11 |
+
</div>
|
12 |
+
<div class="form-group">
|
13 |
+
<label for="web_property_id" class="col-sm-3 control-label">Tracking ID</label>
|
14 |
+
<div class="col-sm-9">
|
15 |
+
<input type="text" class="form-control" name="web_property_id" id="web_property_id" placeholder="Tracking code example: UA-23710711-7" value="<?php echo get_option('web_property_id'); ?>">
|
16 |
+
<span class="error hide"><strong>Error! </strong> match your code with this forma: UA-41115660-1</span> </div>
|
17 |
+
</div>
|
18 |
+
<div class="form-group">
|
19 |
+
<label for="web_property_id" class="col-sm-3 control-label"></label>
|
20 |
+
<div class="col-sm-9"> <i>Advanced settings:</i> </div>
|
21 |
+
</div>
|
22 |
+
<div class="form-group">
|
23 |
+
<div class="col-sm-offset-3 col-sm-9">
|
24 |
+
<div class="checkbox">
|
25 |
+
<label>
|
26 |
+
<input type="checkbox" name="in_footer" id="in_footer" <?php if(get_option('in_footer')=='on'): ?> checked="checked" <?php endif; ?>>
|
27 |
+
Place code in footer </label>
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
<div class="form-group">
|
32 |
+
<div class="col-sm-offset-3 col-sm-9">
|
33 |
+
<div class="checkbox">
|
34 |
+
<label>
|
35 |
+
<input type="checkbox" name="track_links" id="track_links" <?php if(get_option('track_links')=='on'): ?> checked="checked" <?php endif; ?>>
|
36 |
+
Track events (Downloads, Mailto & Outbound URLs) </label>
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
<div class="form-group">
|
41 |
+
<div class="col-sm-offset-3 col-sm-9">
|
42 |
+
<div class="checkbox">
|
43 |
+
<label>
|
44 |
+
<input type="checkbox" name="enable_display" id="enable_display" <?php if(get_option('enable_display')=='on'): ?> checked="checked" <?php endif; ?>>
|
45 |
+
Enable Display Advertising <span style="color:green;">New!</span> </label>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
<div class="form-group">
|
50 |
+
<div class="col-sm-offset-3 col-sm-9">
|
51 |
+
<div class="checkbox">
|
52 |
+
<label>
|
53 |
+
<input type="checkbox" name="anonymize_ip" id="anonymize_ip" <?php if(get_option('anonymize_ip')=='on'): ?> checked="checked" <?php endif; ?>>
|
54 |
+
Anonymize IP <span style="color:green;">New!</span> </label>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
<div class="form-group">
|
59 |
+
<div class="col-sm-offset-3 col-sm-9">
|
60 |
+
<?php global $wp_roles;
|
61 |
+
|
62 |
+
$roles = $wp_roles->get_names(); ?>
|
63 |
+
<div class="checkbox">
|
64 |
+
<label>
|
65 |
+
<input type="checkbox" name="tracking_off_for_role" id="tracking_off_for_role" <?php if(get_option('tracking_off_for_role')=='on'): ?> checked="checked" <?php endif; ?>>
|
66 |
+
Disable Tracking For
|
67 |
+
<select id="tracking_off_for_this_role">
|
68 |
+
<?php foreach($roles as $role) { ?>
|
69 |
+
<option value="<?php echo $role;?>" <?php if(get_option('tracking_off_for_this_role')== $role){echo 'selected="selected"';} ?>><?php echo $role;?></option>
|
70 |
+
<?php } ?>
|
71 |
+
</select>
|
72 |
+
</label>
|
73 |
+
</div>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
<div class="form-group">
|
77 |
+
<div class="col-sm-offset-3 col-sm-9">
|
78 |
+
<input type="hidden" id="ajax_url" name="ajax_url" value="<?php echo admin_url('admin-ajax.php'); ?>" />
|
79 |
+
<button type="button" class="btn btn-primary" id="save-gua-settings">Save Changes</button>
|
80 |
+
<span class="alert alert-success hide"><strong>Options Saved</strong></span> </div>
|
81 |
+
</div>
|
82 |
+
</form>
|
83 |
+
</div>
|
84 |
+
<div class="clearfix"></div>
|
85 |
+
<div class="row col-lg-6">Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%202.2&utm_content=Google%20Universal%20Analytics&utm_campaign=WordPress%20plugins" title="Google Universal Analytics">OnlineAds.lt</a> </div>
|
86 |
+
</div>
|
87 |
+
</br>
|
readme.txt
CHANGED
@@ -3,11 +3,11 @@ Contributors: audriusd
|
|
3 |
Donate link: http://onlineads.lt/
|
4 |
Tags: javascript, tracking, google, analytics, universal, statistics, google analytics, universal analytics, google universal analytics, classic, custom
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
-
Adds the latest Google Universal Analytics JavaScript tracking code to your WordPress website. Event tracking
|
11 |
|
12 |
== Description ==
|
13 |
|
@@ -62,6 +62,10 @@ Also, do not hesitate to contact us if you have any questions regarding [Google
|
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
|
|
65 |
= 2.1.2 =
|
66 |
* jQuery bug fix.
|
67 |
|
@@ -96,6 +100,9 @@ Also, do not hesitate to contact us if you have any questions regarding [Google
|
|
96 |
|
97 |
== Upgrade Notice ==
|
98 |
|
|
|
|
|
|
|
99 |
= 2.1.2 =
|
100 |
* Bug fix.
|
101 |
|
3 |
Donate link: http://onlineads.lt/
|
4 |
Tags: javascript, tracking, google, analytics, universal, statistics, google analytics, universal analytics, google universal analytics, classic, custom
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.9
|
7 |
+
Stable tag: 2.2
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
+
Adds the latest Google Universal Analytics JavaScript tracking code to your WordPress website. Event tracking, Display Advertising (Remarketing) and IP Anonymization now available.
|
11 |
|
12 |
== Description ==
|
13 |
|
62 |
|
63 |
== Changelog ==
|
64 |
|
65 |
+
= 2.2 =
|
66 |
+
* Display Advertising feature added.
|
67 |
+
* IP Anonymization option is now available.
|
68 |
+
|
69 |
= 2.1.2 =
|
70 |
* jQuery bug fix.
|
71 |
|
100 |
|
101 |
== Upgrade Notice ==
|
102 |
|
103 |
+
= 2.2 =
|
104 |
+
* Display Advertising and IP Anonymization options added.
|
105 |
+
|
106 |
= 2.1.2 =
|
107 |
* Bug fix.
|
108 |
|
tracking-code.php
CHANGED
@@ -1,40 +1,88 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$
|
4 |
-
|
5 |
-
$
|
6 |
-
|
7 |
-
$
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
(
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
<?php endif;
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$web_property_id = get_option( 'web_property_id' );
|
4 |
+
|
5 |
+
$track_links = get_option('track_links');
|
6 |
+
|
7 |
+
$enable_display = get_option('enable_display');
|
8 |
+
|
9 |
+
$anonymize_ip = get_option('anonymize_ip');
|
10 |
+
|
11 |
+
$homeurl = get_option('home');
|
12 |
+
|
13 |
+
$find = array( 'http://', 'https://', 'www.' );
|
14 |
+
|
15 |
+
$replace = '';
|
16 |
+
|
17 |
+
$homeurl = str_replace( $find, $replace, $homeurl );
|
18 |
+
|
19 |
+
?>
|
20 |
+
|
21 |
+
<!-- Google Universal Analytics for WordPress -->
|
22 |
+
|
23 |
+
<script>
|
24 |
+
|
25 |
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
26 |
+
|
27 |
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
28 |
+
|
29 |
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
30 |
+
|
31 |
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
ga('create', '<?php echo $web_property_id; ?>', '<?php echo $homeurl; ?>');
|
36 |
+
<?php if($anonymize_ip=='on'): ?>
|
37 |
+
ga('set', 'anonymizeIp', true);
|
38 |
+
<?php endif; ?>
|
39 |
+
<?php if($enable_display=='on'): ?>
|
40 |
+
ga('require', 'displayfeatures');
|
41 |
+
<?php endif; ?>
|
42 |
+
ga('send', 'pageview');
|
43 |
+
|
44 |
+
</script>
|
45 |
+
|
46 |
+
<?php if($track_links=='on'): ?>
|
47 |
+
|
48 |
+
<script type="text/javascript">
|
49 |
+
|
50 |
+
jQuery(document).ready(function(e) {
|
51 |
+
|
52 |
+
jQuery('a').click(function(e) {
|
53 |
+
|
54 |
+
var $this = jQuery(this);
|
55 |
+
|
56 |
+
var href = $this.prop('href').split('?')[0];
|
57 |
+
|
58 |
+
var ext = href.split('.').pop();
|
59 |
+
|
60 |
+
if ('xls,xlsx,doc,docx,ppt,pot,pptx,pdf,pub,txt,zip,rar,tar,7z,exe,wma,mov,avi,wmv,wav,mp3,midi,csv,tsv,jar,psd,pdn,ai,pez,wwf'.split(',').indexOf(ext) !== -1) {
|
61 |
+
|
62 |
+
ga('send', 'event', 'Download', ext, href);
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
if (href.toLowerCase().indexOf('mailto:') === 0) {
|
67 |
+
|
68 |
+
ga('send', 'event', 'Mailto', href.substr(7));
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
if ((this.protocol === 'http:' || this.protocol === 'https:') && this.hostname.indexOf(document.location.hostname) === -1) {
|
75 |
+
|
76 |
+
ga('send', 'event', 'Outbound', this.hostname, this.pathname);
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
});
|
83 |
+
|
84 |
+
});
|
85 |
+
|
86 |
+
</script>
|
87 |
+
|
88 |
<?php endif;
|