Skip to content

Rename JavaScript addPageAction to trackEvent#6828

Merged
aduth merged 2 commits intomainfrom
aduth-rename-add-page-action-2
Aug 24, 2022
Merged

Rename JavaScript addPageAction to trackEvent#6828
aduth merged 2 commits intomainfrom
aduth-rename-add-page-action-2

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Aug 23, 2022

Why:

Implementation Notes:

I had initially considered removing the AnalyticsContext altogether and calling trackEvent directly, but since it's used in the document capture application to inject the flow_path parameter, the context wrapper felt useful / necessary to keep.

**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
@aduth aduth requested a review from solipet August 23, 2022 19:59
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* @typedef AnalyticsContext
*
* @prop {TrackEvent} addPageAction Log an action with optional payload.
* @prop {TrackEvent} trackEvent Log an action with optional payload.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we link to the controller here with the list of payload names it recognizes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Added in be566e7.

@aduth aduth merged commit 27a2b8f into main Aug 24, 2022
@aduth aduth deleted the aduth-rename-add-page-action-2 branch August 24, 2022 15:36
@aduth aduth mentioned this pull request Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants