diff --git a/README.md b/README.md index 0e2d1c67..128359c2 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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: diff --git a/src/consent-manager-builder/fetch-destinations.ts b/src/consent-manager-builder/fetch-destinations.ts index 7fee3493..04e2fac2 100644 --- a/src/consent-manager-builder/fetch-destinations.ts +++ b/src/consent-manager-builder/fetch-destinations.ts @@ -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