...
Implementing events in edx-platform is documented in Read the Docs, but this Docs and /wiki/spaces/AN/pages/30967007. This section provides some additional clarity and examples.
...
- Rule of thumb: Use server-side events where possible. More context is available to server-side events. Server-side events are less likely to have false duplicate events.
- Call tracker.emit
- Emits to Tracking Log and downstream tools (e.g. Vertica/Tableau, edX Research Package, etc.)
- Event must be whitelisted to emit to Segment.
- In turn, Segment emits to other tools: Google Analytics (GA), Google Tag Manager, Optimizely, Qualaroo, Crazy Egg, Marketing tools.
- Here are sample commits for updating the whitelist for edge.edx.org and the whitelists for edx.org.
- At this time, it doesn't look like our code supports sending special labels to GA from server-side events. See /wiki/spaces/AN/pages/30967007 for possibly enhancing this.
Client-side events
- Rule of thumb: Where you have an option of client-side or server-side event, choose server-side (see above).
- Logger.log
- Important: This should be renamed to Tracker.emit, but that requires a deprecation strategy including telling course teams.
- Emits to Tracking Log and downstream tools (e.g. Vertica/Tableau, edX Research Package, etc.)
- Event must be whitelisted to emit to Segment (see above).
- analytics.track
- Use this if you want Segment and its downstream tools only. If you want the Tracking Log or both, use the other call (with or without the whitelist).
- Emits to Segment and its downstream tools.
...