Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Analytics - More than just pageviews #4660

Closed
mheppler opened this issue May 9, 2018 · 4 comments
Closed

Custom Analytics - More than just pageviews #4660

mheppler opened this issue May 9, 2018 · 4 comments

Comments

@mheppler
Copy link
Contributor

mheppler commented May 9, 2018

When reviewing the analytics code we provide in google-analytics-snippet.xhtml and piwik-analytics-snippet.xhtml for the issue Piwik - Counting downloads #4630, it appears that snippets of limit all the various features that Google Analytics and Piwik offer.

@Venki18 had requested we support tracking downloads, which would require changes to our code base. We could deliver this scalability and customization by changing how this analytics code is added to each page. If we followed the examples we developed for Branding Your Installation, then all the analytics code can be moved out of application source code, and into external files that can be pointed to via the custom configuration settings documented in the Installation Guide.

Note: We should explore the request from @Venki18 more to see if the CSS class names he suggests would be beneficial to add to the source code for download or explore or any other event we want to track.

@mheppler
Copy link
Contributor Author

mheppler commented Dec 12, 2018

Easy part is done. Removed the analytics includes from the templates. Now to work on the documentation. Going to try to piece together a to-do list to review with the team before embracing upon a doc writing journey.

  • Add new :WebAnalyticsCode configuration options based on the the other custom content file options in the branding section
  • Add new Web Analytics Code section in Configuration > Installation Guide
  • Outline the Google Analytics tracking code snippet... or just let sysadmins get their own code snippets from their analytics provider by providing links...
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_TRACKING_ID');
</script>
  • Reference Piwik tracking code has been deprecated as well as the rebranding to Matomo ...not sure this is necessary
  • Add documentation of new action btn style classes btn-compute, btn-contact, btn-download, btn-explore, btn-export, btn-preview, btn-request, btn-share to Monitoring > Admin Guide
  • Add new WebAnalyticsCode key to SettingsServiceBean.java and new fileTypeAnalytics param to CustomizationFilesServlet.java and CustomizationConstants.java
  • Add new o:resourceInclude for :WebAnalyticsCode configuration options to dataverse_template.xhtml and iframe.xhtml templates
  • Remove google-analytics-snippet.xhtml and piwik-analytics-snippet.xhtml from iframe.xhtml widget template
  • Remove GoogleAnalyticsCode key from SettingsServiceBean.java
  • Remove :GoogleAnalyticsCode, :PiwikAnalyticsId, :PiwikAnalyticsHost, :PiwikAnalyticsTrackerFileName options from Configuration > Installation Guide
  • Remove :GoogleAnalyticsCode, :PiwikAnalyticsId, :PiwikAnalyticsHost, :PiwikAnalyticsTrackerFileName references from Monitoring > Admin Guide
  • Add event style class naming convention to end user action btns on dataverse, dataset and file pgs (Piwik - Counting downloads #4630)
  • Add reference to Release Notes about the change to existing configuration options

@mheppler
Copy link
Contributor Author

@mheppler
Copy link
Contributor Author

In order to deliver a request from @Venki18 in the original version of this analytics issues (#4630), I have added a new event style class naming convention to btns in the source code of the dataverse, dataset, and file pgs.

Those new style class are:

  • btn-compute
  • btn-contact
  • btn-download
  • btn-explore
  • btn-export
  • btn-preview
  • btn-request
  • btn-share

(There was already a style class for downloadCitation.)

This should cover most end user events worth tracking, and will deliver the level of granularity beyond pageviews, that this issue was originally submitted for.

@mheppler
Copy link
Contributor Author

Thanks to @kcondon, @landreev and @pameyer for the guidance and helping to set up my localhost in Google Analytics to do a quick test of the new config settings. We immediately got some real time results! Submitting a pull request and moving this to code review.

/dataverse/root	Root	10	
20.41%
2.	/dataset.xhtml?persistentId=doi:10.5072/FK2/POM5TI	PLAYBOOK - Bill Belichick Dataverse	4	
8.16%
3.	/	Root Dataverse	3	
6.12%
4.	/dataset.xhtml?persistentId=doi:10.5072/FK2/92JEER	Replication Data for: Two...wo Two Two - 11 Dataverse	3	
6.12%
5.	/dataverse/root/search	Advanced Search - Root	3	
6.12%
6.	/dataset.xhtml?persistentId=doi:10.5072/FK2/EALRA8	One New Subject - Misc Dataverse	2	
4.08%
7.	/dataset.xhtml?persistentId=doi:10.5072/FK2/O5MJ6C	Got Data Got Data Got Dat...Got Data - Misc Dataverse	2	
4.08%
8.	/dataset.xhtml?persistentId=doi:10.5072/FK2/VYKDBF	Samples 2 - First	2	
4.08%
9.	/dataverse/bb5rings	Bill Belichick Dataverse	2	
4.08%
10.	/dataverse/misc	Misc Dataverse	2	
4.08%
11.	/dataverse/root?q=two	Root	2	
4.08%
12.	/dataverse/bb5rings?q=Belichick	Bill Belichick Dataverse	1	
2.04%
13.	/dataverse/first	First	1	
2.04%
14.	/dataverse/root?q=&types=...ateSort&order=desc&page=1	Root	1	
2.04%
15.	/dataverse/root?q=&types=...ateSort&order=desc&page=1	Root	1	
2.04%
16.	/dataverse/root?q=authorName:Admin	Root	1	
2.04%
17.	/dataverse/root?q=authorName:Belichick	Root	1	
2.04%
18.	/dataverse/root?q=authorName:Brady	Root	1	
2.04%
19.	/dataverse/root?q=one	Root	1	
2.04%
20.	/dataverse/root?q=test	Root	1	
2.04%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants