Version Description
- More options in the plugin settings (admin section).
- Big thanks to estepix for code suggestion!
Download this release
Release Info
Developer | audriusd |
Plugin | Google Universal Analytics |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- googleanalytics.php +50 -6
- options.php +5 -3
- readme.txt +79 -72
googleanalytics.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Google Universal Analytics
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/google-universal-analytics/
|
5 |
Description: Adds <a href="http://www.google.com/analytics/">Google Analytics</a> tracking code on all pages.
|
6 |
-
Version: 1.
|
7 |
Author: Audrius Dobilinskas
|
8 |
Author URI: http://onlineads.lt/
|
9 |
*/
|
@@ -38,13 +38,57 @@ function options_page_google_universal_analytics() {
|
|
38 |
}
|
39 |
|
40 |
function google_universal_analytics() {
|
41 |
-
$web_property_id = get_option('web_property_id');
|
42 |
-
?>
|
43 |
|
44 |
-
|
45 |
-
|
|
|
|
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
|
50 |
register_activation_hook(__FILE__, 'activate_google_universal_analytics');
|
3 |
Plugin Name: Google Universal Analytics
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/google-universal-analytics/
|
5 |
Description: Adds <a href="http://www.google.com/analytics/">Google Analytics</a> tracking code on all pages.
|
6 |
+
Version: 1.3
|
7 |
Author: Audrius Dobilinskas
|
8 |
Author URI: http://onlineads.lt/
|
9 |
*/
|
38 |
}
|
39 |
|
40 |
function google_universal_analytics() {
|
41 |
+
$web_property_id = get_option( 'web_property_id' );
|
|
|
42 |
|
43 |
+
// Is the option just the UA id?
|
44 |
+
$web_property_id_p1 = strtoupper( trim( $web_property_id ) );
|
45 |
+
$web_property_id_p2 = '';
|
46 |
+
if ( strpos( $web_property_id_p1, 'UA-' ) === 0 ) {
|
47 |
|
48 |
+
// Does the option have a second parameter? (Comma separator)
|
49 |
+
$web_property_id_p2_pos = strpos( $web_property_id, ',');
|
50 |
+
if ( $web_property_id_p2_pos !== false ) {
|
51 |
+
|
52 |
+
// Isolate the first parameter.
|
53 |
+
$web_property_id_p1_pos = strpos( $web_property_id_p1, ',');
|
54 |
+
if ( $web_property_id_p1_pos !== false ) {
|
55 |
+
$web_property_id_p1 = substr( $web_property_id, 0, $web_property_id_p1_pos );
|
56 |
+
if ( $web_property_id_p1 !== false ) {
|
57 |
+
$web_property_id_p1 = strtoupper( trim( $web_property_id_p1 ) );
|
58 |
+
} else {
|
59 |
+
$web_property_id_p1 = '';
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
// Isolate the second parameter.
|
64 |
+
$web_property_id_p2_pos += 1;
|
65 |
+
$web_property_id_p2 = substr( $web_property_id, $web_property_id_p2_pos );
|
66 |
+
if ( $web_property_id_p2 !== false ) {
|
67 |
+
$web_property_id_p2 = strtolower( trim( $web_property_id_p2 ) );
|
68 |
+
} else {
|
69 |
+
$web_property_id_p2 = '';
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
// Build up a whitespace trimmed javascript that is the GA tracking script.
|
74 |
+
// Include the option. One or two values.
|
75 |
+
$web_property_id_js = '<script>';
|
76 |
+
$web_property_id_js .= '(function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){';
|
77 |
+
$web_property_id_js .= '(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),';
|
78 |
+
$web_property_id_js .= 'm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)';
|
79 |
+
$web_property_id_js .= '})(window,document,\'script\',\'//www.google-analytics.com/analytics.js\',\'ga\');';
|
80 |
+
$web_property_id_js .= 'ga(\'create\',\'' . $web_property_id_p1 . '\'';
|
81 |
+
if ( strlen( $web_property_id_p2 ) > 1 ) {
|
82 |
+
$web_property_id_js .= ',\'' . $web_property_id_p2 . '\'';
|
83 |
+
}
|
84 |
+
$web_property_id_js .= ');ga(\'send\',\'pageview\');';
|
85 |
+
$web_property_id_js .= '</script>';
|
86 |
+
|
87 |
+
$web_property_id = $web_property_id_js;
|
88 |
+
}
|
89 |
+
if ( strpos( $web_property_id, 'UA-' ) !== false ) {
|
90 |
+
echo $web_property_id;
|
91 |
+
}
|
92 |
}
|
93 |
|
94 |
register_activation_hook(__FILE__, 'activate_google_universal_analytics');
|
options.php
CHANGED
@@ -44,7 +44,7 @@
|
|
44 |
* html a:hover { background: transparent; }
|
45 |
</style>
|
46 |
|
47 |
-
<p>Insert your Google Universal Analytics code below
|
48 |
<a class="tooltip" href="#">(Code Example)<span class="classic">
|
49 |
<script></br>
|
50 |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){</br>
|
@@ -57,7 +57,9 @@
|
|
57 |
</br>
|
58 |
</script>
|
59 |
</span></a>:</p>
|
60 |
-
<
|
|
|
|
|
61 |
<?php echo get_option('web_property_id'); ?> </textarea>
|
62 |
|
63 |
<input type="hidden" name="action" value="update" />
|
@@ -67,7 +69,7 @@
|
|
67 |
</p>
|
68 |
|
69 |
</form>
|
70 |
-
Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google
|
71 |
</div>
|
72 |
|
73 |
</br>
|
44 |
* html a:hover { background: transparent; }
|
45 |
</style>
|
46 |
|
47 |
+
<p><b>Option 1:</b> Insert your Google Universal Analytics javascript code below
|
48 |
<a class="tooltip" href="#">(Code Example)<span class="classic">
|
49 |
<script></br>
|
50 |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){</br>
|
57 |
</br>
|
58 |
</script>
|
59 |
</span></a>:</p>
|
60 |
+
<p><b>Option 2:</b> Insert just the web property id. Example: UA-23710779-8</p>
|
61 |
+
<p><b>Option 3:</b> Insert the web property id, a comma and then the domain name. Example: UA-23710779-8,onlineads.lt</p>
|
62 |
+
<textarea name="web_property_id" id="web_property_id" rows="10" cols="65" >
|
63 |
<?php echo get_option('web_property_id'); ?> </textarea>
|
64 |
|
65 |
<input type="hidden" name="action" value="update" />
|
69 |
</p>
|
70 |
|
71 |
</form>
|
72 |
+
Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google%20Universal%20Analytics%201.3&utm_campaign=WordPress%20plugins" title="Google Universal Analytics">OnlineAds.lt</a>
|
73 |
</div>
|
74 |
|
75 |
</br>
|
readme.txt
CHANGED
@@ -1,73 +1,80 @@
|
|
1 |
-
=== Google Universal Analytics ===
|
2 |
-
Contributors: audriusd
|
3 |
-
Donate link: http://onlineads.lt/
|
4 |
-
Tags: javascript, tracking, google, analytics, universal, statistics, google analytics, universal analytics, google universal analytics
|
5 |
-
Requires at least: 2.7
|
6 |
-
Tested up to: 3.8
|
7 |
-
Stable tag: 1.
|
8 |
-
License: GPLv2 or later
|
9 |
-
|
10 |
-
Adds the latest Google Universal Analytics JavaScript tracking code to your WordPress website.
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
|
14 |
-
Adding Google Analytics code to your website has never been easier. Simply copy and paste your tracking code and that's it.
|
15 |
-
|
16 |
-
Why Google Universal Analytics is better than the usual Google Analytics?
|
17 |
-
|
18 |
-
* Custom dimensions & metrics;
|
19 |
-
* Online/Offline data sync;
|
20 |
-
* Multi-platform tracking;
|
21 |
-
* Simplified configuration controls;
|
22 |
-
* ...and more.
|
23 |
-
|
24 |
-
For more information visit: [Google Analytics](http://www.google.com/analytics) or [OnlineAds.lt](http://onlineads.lt).
|
25 |
-
|
26 |
-
== Installation ==
|
27 |
-
|
28 |
-
1. Upload `google-universal-analytics` directory to the `/wp-content/plugins/` directory or use plugin search - Admin > Plugins > Add new > Search for 'Google Universal Analytics'.
|
29 |
-
2. Activate the plugin through the 'Plugins' menu in WordPress
|
30 |
-
3. Paste tracking code from Google Analytics to the settings (Admin > Settings > Google Universal Analytics)
|
31 |
-
|
32 |
-
== Frequently Asked Questions ==
|
33 |
-
|
34 |
-
= How to install Google Analytics for my WordPress blog? =
|
35 |
-
|
36 |
-
Follow the link for step-by-step guide:
|
37 |
-
[http://onlineads.lt/how-to-install-google-universal-analytics-for-your-wordpress-blog/](http://onlineads.lt/how-to-install-google-universal-analytics-for-your-wordpress-blog/)
|
38 |
-
|
39 |
-
= How can I update and modify the tracking code? =
|
40 |
-
|
41 |
-
The same way you entered it the first time: Admin > Settings > Google Universal Analytics
|
42 |
-
|
43 |
-
= How can I get support? =
|
44 |
-
|
45 |
-
[Fill in contact form at our website](http://onlineads.lt/contact-us/). We usually reply within 24 hours.
|
46 |
-
Also, do not hesitate to contact us if you have any questions regarding [Google Analytics](http://onlineads.lt/contact-us/).
|
47 |
-
|
48 |
-
== Screenshots ==
|
49 |
-
|
50 |
-
1. Google Analytics and Google Universal Analytics compared.
|
51 |
-
|
52 |
-
== Changelog ==
|
53 |
-
|
54 |
-
= 1.
|
55 |
-
*
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
*
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
Support link added. If any questions users can contact us now via plugin's interface.
|
1 |
+
=== Google Universal Analytics ===
|
2 |
+
Contributors: audriusd
|
3 |
+
Donate link: http://onlineads.lt/
|
4 |
+
Tags: javascript, tracking, google, analytics, universal, statistics, google analytics, universal analytics, google universal analytics
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 3.8
|
7 |
+
Stable tag: 1.3
|
8 |
+
License: GPLv2 or later
|
9 |
+
|
10 |
+
Adds the latest Google Universal Analytics JavaScript tracking code to your WordPress website.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
Adding Google Analytics code to your website has never been easier. Simply copy and paste your tracking code and that's it.
|
15 |
+
|
16 |
+
Why Google Universal Analytics is better than the usual Google Analytics?
|
17 |
+
|
18 |
+
* Custom dimensions & metrics;
|
19 |
+
* Online/Offline data sync;
|
20 |
+
* Multi-platform tracking;
|
21 |
+
* Simplified configuration controls;
|
22 |
+
* ...and more.
|
23 |
+
|
24 |
+
For more information visit: [Google Analytics](http://www.google.com/analytics) or [OnlineAds.lt](http://onlineads.lt).
|
25 |
+
|
26 |
+
== Installation ==
|
27 |
+
|
28 |
+
1. Upload `google-universal-analytics` directory to the `/wp-content/plugins/` directory or use plugin search - Admin > Plugins > Add new > Search for 'Google Universal Analytics'.
|
29 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
30 |
+
3. Paste tracking code from Google Analytics to the settings (Admin > Settings > Google Universal Analytics)
|
31 |
+
|
32 |
+
== Frequently Asked Questions ==
|
33 |
+
|
34 |
+
= How to install Google Analytics for my WordPress blog? =
|
35 |
+
|
36 |
+
Follow the link for step-by-step guide:
|
37 |
+
[http://onlineads.lt/how-to-install-google-universal-analytics-for-your-wordpress-blog/](http://onlineads.lt/how-to-install-google-universal-analytics-for-your-wordpress-blog/)
|
38 |
+
|
39 |
+
= How can I update and modify the tracking code? =
|
40 |
+
|
41 |
+
The same way you entered it the first time: Admin > Settings > Google Universal Analytics
|
42 |
+
|
43 |
+
= How can I get support? =
|
44 |
+
|
45 |
+
[Fill in contact form at our website](http://onlineads.lt/contact-us/). We usually reply within 24 hours.
|
46 |
+
Also, do not hesitate to contact us if you have any questions regarding [Google Analytics](http://onlineads.lt/contact-us/).
|
47 |
+
|
48 |
+
== Screenshots ==
|
49 |
+
|
50 |
+
1. Google Analytics and Google Universal Analytics compared.
|
51 |
+
|
52 |
+
== Changelog ==
|
53 |
+
|
54 |
+
= 1.3 =
|
55 |
+
* More options in the plugin settings (admin section).
|
56 |
+
* Big thanks to estepix for code suggestion!
|
57 |
+
|
58 |
+
= 1.2 =
|
59 |
+
* Important: After updating enter full tracking code (not just Web Property ID).
|
60 |
+
|
61 |
+
= 1.1 =
|
62 |
+
* Minor fix in tracking code.
|
63 |
+
|
64 |
+
= 1.0 =
|
65 |
+
* Documentation updated.
|
66 |
+
* Support link added.
|
67 |
+
|
68 |
+
== Upgrade Notice ==
|
69 |
+
|
70 |
+
= 1.3 =
|
71 |
+
* Important: Bug fixed, more options available.
|
72 |
+
|
73 |
+
= 1.2 =
|
74 |
+
* Important: Bug fixed. After updating enter full tracking code (not just Web Property ID).
|
75 |
+
|
76 |
+
= 1.1 =
|
77 |
+
Tracking code updated.
|
78 |
+
|
79 |
+
= 1.0 =
|
80 |
Support link added. If any questions users can contact us now via plugin's interface.
|