diff --git a/.hgignore b/.hgignore
deleted file mode 100644
index 7ead5da..0000000
--- a/.hgignore
+++ /dev/null
@@ -1,3 +0,0 @@
-\.sw.*$
-~$
-build/
diff --git a/GoogleAnalyticsPlugin.php b/OmekaGoogleAnalyticsPlugin.php
similarity index 80%
rename from GoogleAnalyticsPlugin.php
rename to OmekaGoogleAnalyticsPlugin.php
index fe90240..a1b4ccd 100644
--- a/GoogleAnalyticsPlugin.php
+++ b/OmekaGoogleAnalyticsPlugin.php
@@ -23,16 +23,16 @@
*
*/
-define('GOOGLE_ANALYTICS_PLUGIN_VERSION', get_plugin_ini('GoogleAnalytics', 'version'));
+define('GOOGLE_ANALYTICS_PLUGIN_VERSION', get_plugin_ini('OmekaGoogleAnalytics', 'version'));
define('GOOGLE_ANALYTICS_PLUGIN_DIR', dirname(__FILE__));
define('GOOGLE_ANALYTICS_ACCOUNT_OPTION', 'googleanalytics_account_id');
-class GoogleAnalyticsPlugin extends Omeka_Plugin_AbstractPlugin
+class OmekaGoogleAnalyticsPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks =array(
'install',
'uninstall',
- 'public_footer',
+ 'public_head',
'config',
'config_form'
);
@@ -43,26 +43,26 @@ public function hookInstall()
{
set_option('googleanalytics_version', GOOGLE_ANALYTICS_PLUGIN_DIR);
}
+
public function hookUninstall()
{
delete_option('googleanalytics_version');
delete_option(GOOGLE_ANALYTICS_ACCOUNT_OPTION);
}
- public function hookPublicFooter()
+
+ public function hookPublicHead()
{
$accountId = get_option(GOOGLE_ANALYTICS_ACCOUNT_OPTION);
if (empty($accountId)) {
return;
}
- $js = file_get_contents(GOOGLE_ANALYTICS_PLUGIN_DIR . '/snippet.js');
- $html = '';
-
- echo $html;
+ $jstemplate = file_get_contents(GOOGLE_ANALYTICS_PLUGIN_DIR . '/gtag.js');
+ $js = str_replace("GA_MEASUREMENT_ID", $accountId, $jstemplate);
+
+ echo $js;
}
+
public function hookConfig($args)
{
$post = $args['post'];
@@ -71,6 +71,7 @@ public function hookConfig($args)
$post[GOOGLE_ANALYTICS_ACCOUNT_OPTION]
);
}
+
public function hookConfigForm()
{
include GOOGLE_ANALYTICS_PLUGIN_DIR . '/config_form.php';
diff --git a/README.mkd b/README.md
similarity index 64%
rename from README.mkd
rename to README.md
index e1faf81..27ed1d4 100644
--- a/README.mkd
+++ b/README.md
@@ -13,16 +13,17 @@ Plugins](http://omeka.org/codex/Managing_Plugins) for more information). On the
configuration screen, you will need to paste in the Google Analytics
JavaScript. You can do that by following these steps:
- 1. Log onto [Google Analytics](https://www.google.com/analytics/);
+ 1. Log onto [Google Analytics](https://analytics.google.com/)
- 2. Click "Edit" for the profile you wish to use;
+ 2. Click "Admin" in the bottom left
- 3. Click "Check Status" (it will be a small link near the top of the page);
+ 3. Select the Account and Property you wish to add Google Analytics to
- 4. Copy all of the text in the box labelled "Paste this code on your site";
- and
+ 4. Click "Tracking Info" then "Tracking Code"
+
+ 5. Copy the Tracking ID at the top of the page (starts with 'UA-')
- 5. Paste it into the box on the plugin configuration page.
+ 5. Paste it into the box on the plugin configuration page and save changes
That's it. You should start seeing results in Google Analytics in 24-48 hours.
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 05d00dc..0000000
--- a/build.xml
+++ /dev/null
@@ -1,208 +0,0 @@
-
-
-
-
-
To find you Google Analytics Account ID, follow these steps: