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

Google analytics download event - writing is broken #968

Closed
hackartisan opened this issue May 12, 2017 · 10 comments
Closed

Google analytics download event - writing is broken #968

hackartisan opened this issue May 12, 2017 · 10 comments
Assignees
Milestone

Comments

@hackartisan
Copy link
Contributor

The javascript that sends an event to google to register looks for an id that no longer exists in the view code. It also looks for a data: label that is no longer there:

https://github.com/projecthydra-labs/hyrax/blob/master/app/assets/javascripts/hyrax/ga_events.js

These need to be added to the link_to hyrax.download_path of each file in https://github.com/projecthydra-labs/hyrax/tree/master/app/views/hyrax/file_sets/media_display

@awead
Copy link
Contributor

awead commented May 15, 2017

We should use a css class instead of an id. The class can then be added to any or all links that need to be registered as a download.

@hackartisan
Copy link
Contributor Author

@awead what other links are you thinking of?

@awead
Copy link
Contributor

awead commented May 15, 2017

There are some download options related to the fileset. There have been recent discussions to do away with using GA to count downloads because if anyone uses Ghostery or other similar JS blockers, the stats won't get counted. A better way to solve this might be to just count hits to the controller and store them in the database. The table is already there, I believe. However, this work should be separate from this ticket. Just adding file_download to the views under media_display would suffice.

@hackartisan
Copy link
Contributor Author

I don't think GA should be entirely circumvented; lots of people will want to integrate into their existing GA infrastructure. If you want to use the controller, we should write directly to GA from there, e.g. using staccato as OSU has done: https://github.com/osulp/Scholars-Archive/pull/310/files

But yes, this should be another issue.

@awead
Copy link
Contributor

awead commented May 15, 2017

There's an analytics working group forming now. I'd wait and see what they report back with.

@mjgiarlo
Copy link
Member

I'm hesitant to hang up @HackMasterA's bug fix by entangling it with a WG that hasn't been chartered yet.

@jrochkind
Copy link
Contributor

jrochkind commented May 15, 2017

In general, GA is not going to be 100% accurate. I think this is probably true of all analytics in one way or another, although it's true you can work around javascript disabling with server-side events.

Although if you're using HTTP caching via a CDN or otherwise, which seems especially likely for downloads, it's server-side events that no longer capture properly, while client-side JS is better.

In the past and working with others in the industry, I think people usually consider GA's "not exact, may may miss some" to be an education issue, rather than something that can be "fixed". There are diminishing returns trying to "capture everything with 100% reliability and report it exactly accurately", you'll never get there. It may just be a staff education issue -- analytics are inevitably not perfect, they are an estimate.

@awead
Copy link
Contributor

awead commented May 15, 2017

@mjgiarlo I wasn't suggesting that. There's two separate issues here: 1) what to do now, and 2) what to do later. The WG should inform the latter issue. In terms of what to do now, I was only suggesting css classes as opposed to ids because there may be multiple download links in a page. But, I won't hold up this PR over that.

1 similar comment
@awead
Copy link
Contributor

awead commented May 15, 2017

@mjgiarlo I wasn't suggesting that. There's two separate issues here: 1) what to do now, and 2) what to do later. The WG should inform the latter issue. In terms of what to do now, I was only suggesting css classes as opposed to ids because there may be multiple download links in a page. But, I won't hold up this PR over that.

@mjgiarlo
Copy link
Member

Ah, I misunderstood -- the tyranny of trying to catch up on all the things before 🍵. Thanks, @awead!

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