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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for issue #296
Currently, when
integrations.All
isfalse
andintegrations.Actions Amplitude
istrue
, the latter field will be replaced by thesession_id
that is generated for this destination, resulting in events not reaching Amplitude (Actions).This can be replicated by enabling an instance of Amplitude (Actions), sending an event with
integrations.Actions Amplitude
set to true, and observing both the outbound request payload and how the event populates in the source's debugger:Invoking event from source:
![Screen Shot 2023-03-07 at 2 43 38 PM](https://user-images.githubusercontent.com/93934274/223535820-498c0fcf-a5a0-4ad0-aa0d-f5e5cd63bfd2.png)
Outbound request payload:
![Screen Shot 2023-03-07 at 2 43 51 PM](https://user-images.githubusercontent.com/93934274/223535871-c95dadd7-b4fe-48cd-8d3e-5092901445b8.png)
Event populating in Source Debugger:
![Screen Shot 2023-03-07 at 2 44 04 PM](https://user-images.githubusercontent.com/93934274/223535922-b574f64d-a856-41af-bc32-c7734e159d53.png)
This results in the event not sending to Amplitude.
When
integrations.Amplitude (Actions): true
is part of the event invoked from the client, it takes precedence overintegrations.Actions Amplitude.session_id
and the event will deliver to Amplitude as expected, albeit without the session ID:Invoking event from source:
![Screen Shot 2023-03-07 at 2 44 20 PM](https://user-images.githubusercontent.com/93934274/223536464-1ff5d679-06ee-4471-89be-4579be2d917d.png)
Outbound request payload:
![Screen Shot 2023-03-07 at 2 44 41 PM](https://user-images.githubusercontent.com/93934274/223536593-9b356116-39d0-40cf-8d8c-f1daf840b1d3.png)
Event populating in Source Debugger:
![Screen Shot 2023-03-07 at 2 44 49 PM](https://user-images.githubusercontent.com/93934274/223536625-e6a5cace-5a31-4bef-855f-c343a1263b22.png)
Currently, when
fetchDestinationForWriteKey
is invoked, the destination name for Amplitude (Actions) is changed to the creation name Actions Amplitude, and thesession_id
will take precedence and override the boolean that is being set in theintegrations
object, as with the first example.Added an update to
fetchDestinationForWriteKey
so that the destination name is set asdestination.id
if the destination name is "Amplitude (Actions)". With this change, theintegrations
object should now get set tointegrations.Amplitude (Actions)
and deliver events to Amplitude as expected, as with the second example.session_id
can then be passed to an event’s payload by pulling the value fromlocalStorage.analytics_session_id
and setting it in theproperties
ortraits
object:Session ID as a property:
![Screen Shot 2023-03-07 at 2 45 19 PM](https://user-images.githubusercontent.com/93934274/223537146-1718f7ba-13ce-4afa-8e74-98f43e45f7ca.png)
Both the event and Session ID get sent to Amplitude:
![Screen Shot 2023-03-07 at 2 45 38 PM](https://user-images.githubusercontent.com/93934274/223537178-1f7c7c0a-0d02-43c8-95ee-e49b5427ab64.png)
Added a section called "Destination Considerations" in the readme that mentions this process.