From 30c201959666294be19e0bc2c8b166f71dc0fab9 Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 16:31:02 -0600 Subject: [PATCH 01/14] Delete .hgignore --- .hgignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .hgignore diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 7ead5da..0000000 --- a/.hgignore +++ /dev/null @@ -1,3 +0,0 @@ -\.sw.*$ -~$ -build/ From df2b77553b9011ef0d9b2c5b03cb3c931609c4a8 Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 16:32:10 -0600 Subject: [PATCH 02/14] Rename README.mkd to README.md --- README.mkd => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.mkd => README.md (100%) diff --git a/README.mkd b/README.md similarity index 100% rename from README.mkd rename to README.md From 65b554361aac603f8ca6af8640adc68c6d08cf86 Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 16:35:12 -0600 Subject: [PATCH 03/14] Update plugin.ini --- plugin.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.ini b/plugin.ini index 1c7b701..dbcb109 100644 --- a/plugin.ini +++ b/plugin.ini @@ -1,8 +1,8 @@ [info] - name="GoogleAnalytics" + name="OmekaGoogleAnalytics" author="Scholars' Lab" description="A small plugin to include Google Analytics JavaScript code on pages." - link="https://github.com/erochest/GoogleAnalyticsErr/wiki" + link="https://github.com/DigitalCarleton/OmekaGoogleAnalytics" version="1.3-2.0" tags="google, analytics" omeka_minimum_version="2.1" From e3f7bbfd31380cb41e3562d17fe9ce4c1bc26ff1 Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 16:45:22 -0600 Subject: [PATCH 04/14] Update and rename GoogleAnalyticsPlugin.php to OmekaGoogleAnalytics.php --- ...ticsPlugin.php => OmekaGoogleAnalytics.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) rename GoogleAnalyticsPlugin.php => OmekaGoogleAnalytics.php (84%) diff --git a/GoogleAnalyticsPlugin.php b/OmekaGoogleAnalytics.php similarity index 84% rename from GoogleAnalyticsPlugin.php rename to OmekaGoogleAnalytics.php index fe90240..8fb71bc 100644 --- a/GoogleAnalyticsPlugin.php +++ b/OmekaGoogleAnalytics.php @@ -32,7 +32,7 @@ class GoogleAnalyticsPlugin 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); + $accountId = js_escape(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); + + 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'; From b78d5e8d0cbdc82ee8829754213200295bd4858d Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 16:45:41 -0600 Subject: [PATCH 05/14] Update and rename snippet.js to gtag.js --- gtag.js | 9 +++++++++ snippet.js | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 gtag.js delete mode 100644 snippet.js diff --git a/gtag.js b/gtag.js new file mode 100644 index 0000000..465cf6b --- /dev/null +++ b/gtag.js @@ -0,0 +1,9 @@ + + + diff --git a/snippet.js b/snippet.js deleted file mode 100644 index d0e86bf..0000000 --- a/snippet.js +++ /dev/null @@ -1,9 +0,0 @@ -var _gaq = _gaq || []; -_gaq.push(['_setAccount', accountId]); -_gaq.push(['_trackPageview']); - -(function() { -var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; -ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; -var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); -})(); From 1f66d76c24008a2485bd4c9140edbe27fa65d3a2 Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 16:50:26 -0600 Subject: [PATCH 06/14] Update config_form.php --- config_form.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config_form.php b/config_form.php index c2af29d..96537c8 100644 --- a/config_form.php +++ b/config_form.php @@ -19,10 +19,10 @@

To find you Google Analytics Account ID, follow these steps:

  1. Create or log into -Google Analytics account; +Google Analytics account;
  2. -
  3. Add a "Website Profile" for this Omeka.net website;
  4. -
  5. Copy the value for the account ID found next to the site URL (starts with "UA-");
  6. +
  7. Add a "Property" for this Omeka website;
  8. +
  9. Copy the value for the account ID found in Admin->Property->Tracking Info->Tracking Code. (starts with "UA-");
  10. Paste it into the text field above and save changes.
From 54b3e65f6e85a06e25cd2b9c508aca4622e06b80 Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 16:51:05 -0600 Subject: [PATCH 07/14] Delete build.xml --- build.xml | 208 ------------------------------------------------------ 1 file changed, 208 deletions(-) delete mode 100644 build.xml diff --git a/build.xml b/build.xml deleted file mode 100644 index 05d00dc..0000000 --- a/build.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - A simple build file for Omeka plugins. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From d88d65e245b93ade100521e2320675e37aa5431c Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 16:55:12 -0600 Subject: [PATCH 08/14] Update README.md --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e1faf81..27ed1d4 100644 --- a/README.md +++ 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. From 3fecf6585f573cc2af68d21f1587804998b69012 Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 17:08:42 -0600 Subject: [PATCH 09/14] Update plugin.ini --- plugin.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index dbcb109..a755f29 100644 --- a/plugin.ini +++ b/plugin.ini @@ -6,7 +6,6 @@ version="1.3-2.0" tags="google, analytics" omeka_minimum_version="2.1" - omeka_tested_up_to="2.1.4" optional_plugins="" required_plugins="" From 56881f1376ffb0992077ae63b2d3a2bf92566165 Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 17:09:09 -0600 Subject: [PATCH 10/14] Update OmekaGoogleAnalytics.php --- OmekaGoogleAnalytics.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OmekaGoogleAnalytics.php b/OmekaGoogleAnalytics.php index 8fb71bc..81a1c8e 100644 --- a/OmekaGoogleAnalytics.php +++ b/OmekaGoogleAnalytics.php @@ -23,7 +23,7 @@ * */ -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'); From 56ec49735614be950ab7968ee5cc36b7217956bd Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 17:16:01 -0600 Subject: [PATCH 11/14] Update OmekaGoogleAnalytics.php --- OmekaGoogleAnalytics.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OmekaGoogleAnalytics.php b/OmekaGoogleAnalytics.php index 81a1c8e..ad59f3a 100644 --- a/OmekaGoogleAnalytics.php +++ b/OmekaGoogleAnalytics.php @@ -27,7 +27,7 @@ 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', From 37bfdb40d076f8a45437aee77eaa5b650fb56052 Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 17:16:43 -0600 Subject: [PATCH 12/14] Rename OmekaGoogleAnalytics.php to OmekaGoogleAnalyticsPlugin.php --- OmekaGoogleAnalytics.php => OmekaGoogleAnalyticsPlugin.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename OmekaGoogleAnalytics.php => OmekaGoogleAnalyticsPlugin.php (100%) diff --git a/OmekaGoogleAnalytics.php b/OmekaGoogleAnalyticsPlugin.php similarity index 100% rename from OmekaGoogleAnalytics.php rename to OmekaGoogleAnalyticsPlugin.php From 2aecb3a04bb5994328ff03dbddc2f7580e19a6de Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 17:21:18 -0600 Subject: [PATCH 13/14] Update OmekaGoogleAnalyticsPlugin.php --- OmekaGoogleAnalyticsPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OmekaGoogleAnalyticsPlugin.php b/OmekaGoogleAnalyticsPlugin.php index ad59f3a..f8024fc 100644 --- a/OmekaGoogleAnalyticsPlugin.php +++ b/OmekaGoogleAnalyticsPlugin.php @@ -58,7 +58,7 @@ public function hookPublicHead() } $jstemplate = file_get_contents(GOOGLE_ANALYTICS_PLUGIN_DIR . '/gtag.js'); - $js = str.replace("GA_MEASUREMENT_ID", $accountId); + $js = str_replace("GA_MEASUREMENT_ID", $accountId, $jstemplate); echo $js; } From 51a3764ec5bade3cb8aacdb02c323be2f268241b Mon Sep 17 00:00:00 2001 From: Chris Padilla <38337070+padillac@users.noreply.github.com> Date: Sun, 16 Feb 2020 17:24:12 -0600 Subject: [PATCH 14/14] Update OmekaGoogleAnalyticsPlugin.php --- OmekaGoogleAnalyticsPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OmekaGoogleAnalyticsPlugin.php b/OmekaGoogleAnalyticsPlugin.php index f8024fc..a1b4ccd 100644 --- a/OmekaGoogleAnalyticsPlugin.php +++ b/OmekaGoogleAnalyticsPlugin.php @@ -52,7 +52,7 @@ public function hookUninstall() public function hookPublicHead() { - $accountId = js_escape(get_option(GOOGLE_ANALYTICS_ACCOUNT_OPTION)); + $accountId = get_option(GOOGLE_ANALYTICS_ACCOUNT_OPTION); if (empty($accountId)) { return; }