Version Description
- Documentation updated.
- Support link added.
=
Download this release
Release Info
Developer | audriusd |
Plugin | Google Universal Analytics |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- googleanalytics.php +69 -0
- options.php +28 -0
- readme.txt +56 -0
- screenshot-1.png +0 -0
googleanalytics.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
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 Universal Analytics</a> tracking code on all pages.
|
6 |
+
Version: 1.0
|
7 |
+
Author: Audrius Dobilinskas
|
8 |
+
Author URI: http://onlineads.lt/
|
9 |
+
*/
|
10 |
+
|
11 |
+
if (!defined('WP_CONTENT_URL'))
|
12 |
+
define('WP_CONTENT_URL', get_option('siteurl').'/wp-content');
|
13 |
+
if (!defined('WP_CONTENT_DIR'))
|
14 |
+
define('WP_CONTENT_DIR', ABSPATH.'wp-content');
|
15 |
+
if (!defined('WP_PLUGIN_URL'))
|
16 |
+
define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins');
|
17 |
+
if (!defined('WP_PLUGIN_DIR'))
|
18 |
+
define('WP_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins');
|
19 |
+
|
20 |
+
function activate_google_universal_analytics() {
|
21 |
+
add_option('web_property_id', 'UA-23710779-8');
|
22 |
+
}
|
23 |
+
|
24 |
+
function deactive_google_universal_analytics() {
|
25 |
+
delete_option('web_property_id');
|
26 |
+
}
|
27 |
+
|
28 |
+
function admin_init_google_universal_analytics() {
|
29 |
+
register_setting('google_universal_analytics', 'web_property_id');
|
30 |
+
}
|
31 |
+
|
32 |
+
function admin_menu_google_universal_analytics() {
|
33 |
+
add_options_page('Google Universal Analytics', 'Google Universal Analytics', 'manage_options', 'google_universal_analytics', 'options_page_google_universal_analytics');
|
34 |
+
}
|
35 |
+
|
36 |
+
function options_page_google_universal_analytics() {
|
37 |
+
include(WP_PLUGIN_DIR.'/google-universal-analytics/options.php');
|
38 |
+
}
|
39 |
+
|
40 |
+
function google_universal_analytics() {
|
41 |
+
$web_property_id = get_option('web_property_id');
|
42 |
+
?>
|
43 |
+
|
44 |
+
<script>
|
45 |
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
46 |
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
47 |
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
48 |
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
49 |
+
|
50 |
+
ga('create', '<?php echo $web_property_id ?>', '<?php echo $siteurl ?>');
|
51 |
+
ga('send', 'pageview');
|
52 |
+
|
53 |
+
</script>
|
54 |
+
<?php
|
55 |
+
}
|
56 |
+
|
57 |
+
register_activation_hook(__FILE__, 'activate_google_universal_analytics');
|
58 |
+
register_deactivation_hook(__FILE__, 'deactive_google_universal_analytics');
|
59 |
+
|
60 |
+
if (is_admin()) {
|
61 |
+
add_action('admin_init', 'admin_init_google_universal_analytics');
|
62 |
+
add_action('admin_menu', 'admin_menu_google_universal_analytics');
|
63 |
+
}
|
64 |
+
|
65 |
+
if (!is_admin()) {
|
66 |
+
add_action('wp_head', 'google_universal_analytics');
|
67 |
+
}
|
68 |
+
|
69 |
+
?>
|
options.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h2>Google Universal Analytics</h2>
|
3 |
+
|
4 |
+
<form method="post" action="options.php">
|
5 |
+
<?php wp_nonce_field('update-options'); ?>
|
6 |
+
<?php settings_fields('google_universal_analytics'); ?>
|
7 |
+
|
8 |
+
<table class="form-table">
|
9 |
+
|
10 |
+
<tr valign="top">
|
11 |
+
<th scope="row">Web Property ID:</th>
|
12 |
+
<td><input type="text" name="web_property_id" value="<?php echo get_option('web_property_id'); ?>" /></td>
|
13 |
+
</tr>
|
14 |
+
|
15 |
+
</tr>
|
16 |
+
|
17 |
+
</table>
|
18 |
+
|
19 |
+
|
20 |
+
<input type="hidden" name="action" value="update" />
|
21 |
+
|
22 |
+
<p class="submit">
|
23 |
+
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
24 |
+
</p>
|
25 |
+
|
26 |
+
</form>
|
27 |
+
Have a question? Drop us a question at <a href="http://onlineads.lt/?utm_source=WordPress&utm_medium=Google+Universal+Analytics+-+Options+page&utm_campaign=WordPress+plugins" title="Google Universal Analytics">OnlineAds.lt</a>
|
28 |
+
</div>
|
readme.txt
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Google Universal Analytics ===
|
2 |
+
Contributors: Audrius Dobilinskas
|
3 |
+
Donate link: http://onlineads.lt/
|
4 |
+
Tags: javascript, tracking, google, analytics, universal, statistics, google analytics, universal analytics
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 3.5.1
|
7 |
+
Stable tag: 1.0
|
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 add your Web Property ID 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. Add the web property ID from Google Analytics (UA-23710779-8, etc.) to the settings (Admin > Settings > Google Universal Analytics)
|
31 |
+
|
32 |
+
== Frequently Asked Questions ==
|
33 |
+
|
34 |
+
= How can I change Web Property ID? =
|
35 |
+
|
36 |
+
The same way you entered it the first time: Admin > Settings > Google Universal Analytics
|
37 |
+
|
38 |
+
= How can I get support? =
|
39 |
+
|
40 |
+
[Fill in contact form at our website](http://onlineads.lt/contact-us/). We usually reply within 24 hours.
|
41 |
+
Also, do not hesitate to contact us if you have any questions regarding [Google Analytics](http://onlineads.lt/contact-us/).
|
42 |
+
|
43 |
+
== Screenshots ==
|
44 |
+
|
45 |
+
1. Google Analytics and Google Universal Analytics compared.
|
46 |
+
|
47 |
+
== Changelog ==
|
48 |
+
|
49 |
+
= 1.0 =
|
50 |
+
* Documentation updated.
|
51 |
+
* Support link added.
|
52 |
+
|
53 |
+
== Upgrade Notice ==
|
54 |
+
|
55 |
+
= 1.0 =
|
56 |
+
Support link added. If any questions users can contact us now via plugin's interface.
|
screenshot-1.png
ADDED
Binary file
|