Skip to content

Commit

Permalink
Merge pull request #348 from unepwcmc/download-tracking
Browse files Browse the repository at this point in the history
track oecm downloads
  • Loading branch information
stacytalbot authored Dec 16, 2019
2 parents 7086918 + 0744ce3 commit f000bf8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
5 changes: 4 additions & 1 deletion app/assets/javascripts/modules/cms/base.js.coffee
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 - CMS", 'click', label)
)
)
)
14 changes: 8 additions & 6 deletions app/views/shared/_google_analytics.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

<% if Rails.env == 'staging' %>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-12920389-5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

gtag('config', 'UA-12920389-5');
ga('create', 'UA-12920389-5', 'auto');
ga('require', 'linkid');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>

<% elsif Rails.env == 'production' %>
Expand Down
15 changes: 0 additions & 15 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f000bf8

Please sign in to comment.