Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Google Analytics #364

Closed
4 of 7 tasks
kimwdavidson opened this issue Jul 27, 2020 · 7 comments
Closed
4 of 7 tasks

Google Analytics #364

kimwdavidson opened this issue Jul 27, 2020 · 7 comments
Assignees

Comments

@kimwdavidson
Copy link
Contributor

kimwdavidson commented Jul 27, 2020

User story

As a data.gov team, I want to add analytics capabilities to the catalog-next so we will be able to analyze this data and share with data owners.

Acceptance criteria

  • GIVEN that a user navigates to the catalog-next public site
    • WHEN they visit a page or use the search function
      • THEN we capture the analytics data with the same analytics platforms used in the classic catalog
      • THEN we are able to expose these statistics to data.gov team

Tasks

  • Confirm with Hyon that we need to use two analytics tracker IDs
  • Install GSA analytics extension at catalog-next repo
    • Add tests if required
    • Run tests
    • Ensure tests are green in CI

Details

There is more background information in DatagovDeploy#1406

@thejuliekramer
Copy link
Contributor

@adborden can you give me and @avdata99 permissions to the ckanext-googleanalyticsbasic repo please

@avdata99
Copy link
Contributor

avdata99 commented Aug 7, 2020

PRs:

  • For analytics ext to add tests and CI config here
  • For new catalog to add the extension here
  • For sandbox to add the plugin here

@avdata99
Copy link
Contributor

avdata99 commented Aug 7, 2020

How to QA?
All PRs are merged, validate this changes are deployed to the sandbox and then:

Open source code on https://catalog-next.sandbox.datagov.us/dataset and check for analytics code

<!-- Digital Analytics Program roll-up, see https://analytics.usa.gov for data -->
<!-- federated_analytics start -->
<script id="_fed_an_ua_tag" src="https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=GSA"></script>
<!-- federated_analytics end -->
<!-- Snippet snippets/googleanalyticsbasic_header.html end -->

And

<script>
(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');
  ga_trackers = [];
    
  ga('create', 'UA-1010101-1', 'auto', 'tracker1');
  ga('tracker1.set', 'anonymizeIp', true);
  ga('tracker1.send', 'pageview');
  ga_trackers.push('tracker1');
    
  ga('create', 'UA-1010101-2', 'auto', 'tracker2');
  ga('tracker2.set', 'anonymizeIp', true);
  ga('tracker2.send', 'pageview');
  ga_trackers.push('tracker2');

@adborden
Copy link
Contributor

@avdata99 is it possible to disable GA by config in production.ini? I think we'll want it disabled for sandbox.

@ghost ghost assigned woodt and unassigned avdata99 and thejuliekramer Aug 10, 2020
@woodt
Copy link
Contributor

woodt commented Aug 11, 2020

Visited the dataset at https://catalog-next.sandbox.datagov.us/dataset/wsrd-radio-receiver-systems-rd-innovation-needs-and-impacts-on-technology-and-policy-works, inspected the HTML source, and confirmed that the two JavaScript snippets indicated above are present. Also confirmed that there were no JavaScript errors when loading the page (under Chrome.)

@ghost ghost closed this as completed Aug 17, 2020
@avdata99
Copy link
Contributor

@avdata99 is it possible to disable GA by config in production.ini? I think we'll want it disabled for sandbox.

Should we add a new issue to activate Analytics for stagging and remove it from the sandbox environment?

@adborden
Copy link
Contributor

@avdata99 yes, please go ahead and create that issue.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants