Rename JavaScript addPageAction to trackEvent#6828
Conversation
**Why**: - For alignment to the Ahoy/CloudWatch-based Ruby track_event method, to which it corresponds - For alignment to 18f/identity-analytics trackEvent method, which it wraps - To avoid falsely aligning to NewRelic's addPageAction, to which it does **not** correspond changelog: Internal, Analytics, Align JavaScript and Ruby analytics logging method name
| * @typedef AnalyticsContext | ||
| * | ||
| * @prop {TrackEvent} addPageAction Log an action with optional payload. | ||
| * @prop {TrackEvent} trackEvent Log an action with optional payload. |
There was a problem hiding this comment.
should we link to the controller here with the list of payload names it recognizes?
There was a problem hiding this comment.
Technically the controller will handle any event we throw at it, and the allowlist only exists to avoid the "Frontend:" prefixing. But I think it wouldn't hurt to include a reference to it.
There was a problem hiding this comment.
Actually, since this context is specific to document capture, it'd probably be more applicable in the @18f/identity-analytics package, and it might be something we could surface in a README.md there, which would be good to have anyways. I think I'll go that route.
There was a problem hiding this comment.
it might be something we could surface in a
README.mdthere, which would be good to have anyways. I think I'll go that route.
Added in be566e7.
Why:
track_eventmethod, to which it corresponds@18f/identity-analyticstrackEvent method, which it wraps.addPageAction, to which it is not related (as of Remove NewRelic frontend event logging #6302).Implementation Notes:
I had initially considered removing the
AnalyticsContextaltogether and callingtrackEventdirectly, but since it's used in the document capture application to inject theflow_pathparameter, the context wrapper felt useful / necessary to keep.