From 6776b81ea3c0f4f365078fdfd07c7593890d57e5 Mon Sep 17 00:00:00 2001 From: Will Kocur Date: Fri, 6 Dec 2019 11:49:29 +0000 Subject: [PATCH 1/3] track oecm downloads --- app/assets/javascripts/content.js | 1 + .../javascripts/modules/cms/base.js.coffee | 5 ++++- .../cms/tracked_download_links.js.coffee | 17 +++++++++++++++++ docs/installation.md | 15 --------------- 4 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 app/assets/javascripts/modules/cms/tracked_download_links.js.coffee diff --git a/app/assets/javascripts/content.js b/app/assets/javascripts/content.js index 68e296930..7613606e4 100644 --- a/app/assets/javascripts/content.js +++ b/app/assets/javascripts/content.js @@ -2,4 +2,5 @@ //= require 'base' //= require 'modules/cms/article_navigation' //= require 'modules/cms/external_links' +//= require 'modules/cms/tracked_download_links' //= require 'modules/cms/base' \ No newline at end of file diff --git a/app/assets/javascripts/modules/cms/base.js.coffee b/app/assets/javascripts/modules/cms/base.js.coffee index 4ffeb84a1..ca8163e7d 100644 --- a/app/assets/javascripts/modules/cms/base.js.coffee +++ b/app/assets/javascripts/modules/cms/base.js.coffee @@ -1,11 +1,14 @@ $(document).ready( -> - require(['cms:article_navigation', 'cms:external_links'], (ArticleNavigation, ExternalLinks) -> + require(['cms:article_navigation', 'cms:external_links', 'cms:tracked_download_links'], (ArticleNavigation, ExternalLinks, TrackedDownloadLinks) -> if $verticalNav = $('.vertical-nav') ArticleNavigation.initialize($verticalNav) if $links = $('.article a') ExternalLinks.initialize($links) + if $trackedDownloadLinks = $('[data-track]') + TrackedDownloadLinks.initialize($trackedDownloadLinks) + $cover = $('.hero__cover') if $cover.length > 0 diff --git a/app/assets/javascripts/modules/cms/tracked_download_links.js.coffee b/app/assets/javascripts/modules/cms/tracked_download_links.js.coffee new file mode 100644 index 000000000..01010148a --- /dev/null +++ b/app/assets/javascripts/modules/cms/tracked_download_links.js.coffee @@ -0,0 +1,17 @@ +define('cms:tracked_download_links', [], -> + class TrackedDownloadLinks + @initialize: ($tracked_links) -> + new TrackedDownloadLinks($tracked_links).initialize() + + constructor: (@$tracked_links) -> + + initialize: -> + @$tracked_links.each((n, link) -> + label = link.dataset.track + + link.addEventListener('click', -> + if ga? + ga('send', 'event', "Downloads - OECM", 'click', label) + ) + ) +) diff --git a/docs/installation.md b/docs/installation.md index 86a333457..c899d245c 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -45,21 +45,6 @@ package manager. For example, on OS X: yarn install ``` -⚠️ **Take this advice with caution - it might not work...** -If you are installing gdal for the first time, you will need to install an older version as follows: - -``` -git -C "$(brew --repo homebrew/core)" fetch --unshallow -cd "$(brew --repo homebrew/core)" -git checkout db0b0e61ec51a1b3ccc9977d00bc00374700d396 -HOMEBREW_NO_AUTO_UPDATE=1 brew install gdal --with-postgresql -``` - -This is the latest commit pre gdal2, but you can use a different commit. git log master -- Formula/package_name.rb can be used to search commits - -To install a new brew version over an old: brew unpin old, brew unlink old, brew install new --force. Brew switch can be used to link and change versions. -⚠️ **end** - Use `brew services` to start `redis`, `elasticsearch`, and `postgres`. If you are running Ubuntu or another Linux distribution, see "GEOS and From 51fedaf82d23edc5fca226f9f1524121cdbdb3a5 Mon Sep 17 00:00:00 2001 From: Will Kocur Date: Tue, 10 Dec 2019 10:22:07 +0000 Subject: [PATCH 2/3] change event name --- .../javascripts/modules/cms/tracked_download_links.js.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/modules/cms/tracked_download_links.js.coffee b/app/assets/javascripts/modules/cms/tracked_download_links.js.coffee index 01010148a..984fbe6ab 100644 --- a/app/assets/javascripts/modules/cms/tracked_download_links.js.coffee +++ b/app/assets/javascripts/modules/cms/tracked_download_links.js.coffee @@ -11,7 +11,7 @@ define('cms:tracked_download_links', [], -> link.addEventListener('click', -> if ga? - ga('send', 'event', "Downloads - OECM", 'click', label) + ga('send', 'event', "Downloads - CMS", 'click', label) ) ) ) From 0744ce3e1ece55970373aeb7673f6e737b3ae776 Mon Sep 17 00:00:00 2001 From: Will Kocur Date: Wed, 11 Dec 2019 10:45:14 +0000 Subject: [PATCH 3/3] update staging tracking to match production --- app/views/shared/_google_analytics.html.erb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/views/shared/_google_analytics.html.erb b/app/views/shared/_google_analytics.html.erb index 5cf19d6d6..335249382 100644 --- a/app/views/shared/_google_analytics.html.erb +++ b/app/views/shared/_google_analytics.html.erb @@ -1,13 +1,15 @@ <% if Rails.env == 'staging' %> - - <% elsif Rails.env == 'production' %>