To add GA tracking to MFR to track when users click open the Hypothesis panel.
Changes
In mfr/extensions/pdf/templates/viewer.mako, we add GA tracking imports.
In mfr/server/static/js/mfr.child.hypothesis.js, we set window.hypothesisConfig to use the onLayoutChange() callback provided by hypothesis to watch for opening of annotation panel.
Add GA tracking ID to settings and use that in renderer.
Side effects
None
QA Notes
To test this, you'll need access to Google Analytics panel for staging server.
Check to make sure the event is only tracked when users open the panel for the first time on that page. Page refresh counts as a new page. User is counted by browser, not OSF User. So if the same OSFUser opens two browser and opens the panel in both, it counts as two events.
Deployment Notes
Add GOOGLE_ANALYTICS_TRACKING_ID for to staging/prod settings.
Coverage increased (+0.03%) to 71.145% when pulling 3df7593b3c3209b56ac7be9075a82566697de418 on adlius:feature/google-analytics into 1c9b11d4366b3c07ccbcbb7921b9ecc3ea4bcd44 on CenterForOpenScience:develop.
Coverage increased (+0.03%) to 71.145% when pulling a539d458e0183e21d6b642dfa38f6dadaad0d8cf on adlius:feature/google-analytics into 1c9b11d4366b3c07ccbcbb7921b9ecc3ea4bcd44 on CenterForOpenScience:develop.
Ticket
https://openscience.atlassian.net/browse/ENG-44
Purpose
To add GA tracking to MFR to track when users click open the Hypothesis panel.
Changes
mfr/extensions/pdf/templates/viewer.mako
, we add GA tracking imports.mfr/server/static/js/mfr.child.hypothesis.js
, we setwindow.hypothesisConfig
to use theonLayoutChange()
callback provided by hypothesis to watch for opening of annotation panel.Side effects
None
QA Notes
To test this, you'll need access to Google Analytics panel for staging server. Check to make sure the event is only tracked when users open the panel for the first time on that page. Page refresh counts as a new page. User is counted by browser, not OSF User. So if the same OSFUser opens two browser and opens the panel in both, it counts as two events.
Deployment Notes
Add GOOGLE_ANALYTICS_TRACKING_ID for to staging/prod settings.