fairvotereform / RankIt

https://rankit.vote
1 stars 2 forks source link

Log events in Firebase Analytics for significant events #108

Closed ggordn3r closed 3 years ago

ggordn3r commented 4 years ago

As an admin, I want to count significant events so I can track how the site is used over time.

Firebase has a built-in analytics library and we've already set it up. Now we just need to log a few events to it.

How to log events in Firebase: https://firebase.google.com/docs/analytics/events

We want events for:

Ideally, published_poll would include these custom parameters: user_id, poll_id, # of winners, # of choices Ideally, new_vote would include these custom parameters: poll_id, # of choices, # of choices ranked

ggordn3r commented 4 years ago

For Trey's reference -- ignore

Super User Dashboard for states allies - shows their polls not all polls (admin dashboard would show all polls) Exporting emails of those who have logged in. Ideas:

of votes, # of voters, # of polls, # of new accounts

Device breakdown: mobile vs. tablet vs. desktop Acquisition: where are people coming from? Average votes/poll Geographic report: where are Rankit.Vote visitors coming from? Cohort analysis: do people return to vote on more than one poll? Create more than one poll? Conversion tracking: how many people vote vs. bounce? How many choices do people rank on average? Compare to total # of choices. How often do people click on the Call-To-Action at the end? How often do people share polls? Embed?

proggeramlug commented 4 years ago

Do I need to do something here?

ggordn3r commented 4 years ago

Yes, add a logEvent() method to the relevant spots in the code (see linked documentation).

proggeramlug commented 4 years ago

This should be done now, it may take a little before the events show though.

ggordn3r commented 4 years ago

Ok, I'll wait and check on this tomorrow.

ggordn3r commented 4 years ago

No sign of the new events in Firebase. Is that because we're only logging traffic on prod?

Screenshot (146)

proggeramlug commented 4 years ago

MIght be, it would be worth testing that first before trying to find a needle in a haystack.

ggordn3r commented 4 years ago

Metrics are suspiciously low--is it possible that the tracking code was deleted when we migrated from staging? It should be on every page. See Firebase Console --> Analytics over the past 6 months.

Also, we're missing one of the requested metrics: new_account.

ggordn3r commented 4 years ago

I just checked and I don't see the Firebase SDK code snippet in the page source for /home anymore: https://firebase.google.com/docs/analytics/get-started view-source:https://rankit.vote/home It should be on all pages.

Also see my last comment about missing one of the requested metrics. That should be an "event" triggered by creating a new account.

proggeramlug commented 4 years ago

Hmm, I updated to the latest dependency and redeployed. We need to see, the events are a little delayed but we did not change the config.

Also, the JS for analytics would be hidden in our other files, I don't think you would see it in the HTML.

ggordn3r commented 4 years ago

Ok, but something happened on or around Sept 1 that seems to have broken our measurement. We were seeing 100-400 users a day before that and afterwards it reported 0-1. I know that's wrong because of all the bug reports we've been getting.

I'm seeing a lot of "realtime" users right now, so I'll leave this open and check again next week to see if updating the dependencies fixed the issue.

image