You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resolves#4094
## Summary
A view event is logged to Google Analytics when an Explorer is rendered and when the view is changed.
## Details
- A view event is logged if Explorer is scrolled into view so that we only log an event when an Explorer has actually been looked at
- We also log an event when the user updates the view
Logged events are of the following shape:
```
{
"event": "owid.explorer_view",
"explorerPath": "/explorers/democracy",
"explorerView": JSON.stringify({ Dataset: "Polity", Metric: "Democracy", "Sub-metric": "Main index" })
}
```
## Testing
I tested this code by console logging when an event is fired, but I haven't checked to see if these events actually end up in GA.
- Explorer page: http://staging-site-log-explorer-views/explorers/democracy
- [x] Should log one view event on page load
- [x] Should log an event when the view is changed
- Topic page: http://staging-site-log-explorer-views/democracy
- [x] Should log an event when the explorer is scrolled into view
- [x] Should log an event when the view is changed
- [x] Should not log another event when the explorer is scrolled out of view and then again into view
- [x] Should not log an event for the embedded explorer
We want to log custom view events to GA for explorers, similar to how it's done for Grapher and Data pages in #4076.
The text was updated successfully, but these errors were encountered: