Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Fix integrations object key for Amplitude (Actions) #307

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [ConsentManagerBuilder Render Props](#consentmanagerbuilder-render-props)
- [Utility functions](#utility-functions)
- [Setting Custom Anonymous ID](#setting-custom-anonymous-id)
- [Destination Considerations](#destination-considerations)
- [Development](#development)
- [Publishing New Version](#publishing-new-version)
- [License](#license)
Expand Down Expand Up @@ -919,6 +920,14 @@ _Note: Keep in mind that setting the anonymousId in Analytics.js does not overwr

_There are other ways to override the anonymousID, you can find more information [here][]._

### Destination Considerations

##### Amplitude (Actions)

When an Amplitude (Actions) destination is connected and enabled to your source, Analytics.js will automatically populate a session ID in `integrations.Actions Amplitude.session_id`.

Because the Consent Manager overrides the `session_id` key with a boolean value, `session_id` will have to be directly passed in to event calls by retrieving the value for `analytics_session_id` in localStorage. The value can then be set in an event's `traits` or `properties` object.

## Development

To run our storybook locally, simply do:
Expand Down
3 changes: 2 additions & 1 deletion src/consent-manager-builder/fetch-destinations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ async function fetchDestinationForWriteKey(
// Rename creationName to id to abstract the weird data model
for (const destination of destinations) {
// Because of the legacy Fullstory integration the creationName for this integration is the `name`
if (destination.name === 'Fullstory (Actions)') {
// Adding Amplitude (Actions) here as well to account for session_id
if (destination.name === 'Fullstory (Actions)' || destination.name === 'Amplitude (Actions)') {
destination.id = destination.name
} else {
destination.id = destination.creationName
Expand Down