EastCoastGreenwayAlliance / ecg-map

Interactive map and trip planner for the ECGA
https://map.greenway.org
7 stars 0 forks source link

Custom Google Analytics events #44

Closed danrademacher closed 7 years ago

danrademacher commented 7 years ago

@gregallensworth and @tomay have both done some of this -- Tom most recently on https://github.com/GreenInfo-Network/lpi-attrition (not sure where exactly in code).

On this app, we'd want to track:

  1. Search for start
  2. Search for end
  3. Download GPX
  4. Copy link
  5. View cue sheet
danrademacher commented 7 years ago

There might also be React or Redux specific SPA patterns out there that would be easy to use. A common need for SPAs

clhenrick commented 7 years ago

Looks like there are a few React GA libraries, including this one used by Mozilla: https://github.com/react-ga/react-ga

clhenrick commented 7 years ago

@nilesbarnes do you already have a Google Analytics account? If not would you mind signing up for one? I imagine you might already have one for the regular Greenway site but not sure if you'd like to use the same or different one for the map.

https://analytics.google.com/analytics/web/provision/?authuser=0#provision/SignUp/

We'll just need the tracking code from you, which is in the form of UA-xxxxxx-xx where the x's are numbers or letters I believe.

clhenrick commented 7 years ago

Tracking events mentioned above as well as a couple others that might be useful for the ECGA staff:

Once I have a GA tracking code I can update the app with it and remove the temporary one I'm currently using.

clhenrick commented 7 years ago

Now the "no route found" error message will log the current query params in the URL. This will allow ECGA staff to copy and paste them into the app so that they may easily identify topology errors in the data.

Other app errors will be logged with the action as the error type and label as the error message.

clhenrick commented 7 years ago

So the react-ga library doesn't seem to be logging anything to GA, starting to investigate why that is.

clhenrick commented 7 years ago

Confirmed that the following are being recorded using the temporary GA account I set up:

I think the timing and page visits only display for the previous day, the others you can see being logged in real time.

Noting that I set the default URL to https not http so am not sure if the latter will work at the moment.

nilesbarnes commented 7 years ago

@clhenrick Here is our GA code:

UA-20533957-1

clhenrick commented 7 years ago

Thanks @nilesbarnes

clhenrick commented 7 years ago

@nilesbarnes I added your GA code to the app and redeployed it, you should see some events being logged in your GA account. Let me know if you don't see them.

danrademacher commented 7 years ago

I have access to ECG GA dashboard. Will work on getting events logging there. Looks like that account might need to prove ownership of the HerokuApp domain.

clhenrick commented 7 years ago

I just trashed the test GA account I set up, so maybe that will help.

-Chris clhenrick.io

On Fri, Jul 21, 2017 at 9:55 AM, Dan Rademacher notifications@github.com wrote:

I have access to ECG GA dashboard. Will work on getting events logging there. Looks like that account might need to prove ownership of the HerokuApp domain.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EastCoastGreenwayAlliance/ecg-map/issues/44#issuecomment-317054670, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJ31BKoDEzFZePUpYI6GbSqGJ9o-P7aks5sQNgDgaJpZM4OMyHC .

danrademacher commented 7 years ago

Confirmed this is all working: image