damp-napkin-69254
06/05/2023, 4:58 PMrudder.track("event", parameters, context)
. The key/value pairs in context
will be added to the final event.context
for us. This does not work with the RN SDK. We dug into the iOS source code and Android source code and discovered that the options object is being scrubbed so that only the integrations
key and keys related to external ids are respected. Is there a way to set custom context via RN/iOS/Android? If not, what's the recommended way to pass things like our custom/internal client id, tenant id, app version, etc.? Thanks!damp-napkin-69254
06/05/2023, 5:06 PMcalm-yak-10773
06/05/2023, 8:40 PMconst properties = {
customContext: {
customContext1: {
customKey1: "customValue1",
}
},
key1: "value1",
};
rudderClient.track("Custom track Event - 1", properties);
where customContext is the field which you want to set in the context object.
• So now, as a next step, you can use the following transformation code snippet to achieve the end result of moving the customContext object from properties to the context object:
export function transformEvent(event, metadata) {
const customContext = event.properties?.customContext;
delete event.properties?.customContext;
event.context.customContext = customContext;
return event;
}
Refer here to know more about the transformation feature: https://www.rudderstack.com/docs/features/transformations/
(Please note: Transformation will not work with device mode connections)
Is there a way to set custom context via RN/iOS/Android?For Android and iOS, there do exist a way. • Refer the following Android code (in Kotlin):
val option = RudderOption()
option.putCustomContext("Context1", mapOf("customContextKey" to "customContextValue"))
rudderClient.identify("RudderStack Android userId 2",
RudderTraits()
.put("displayName","RandomName_2")
.putName("RudderStack_2")
.putAge("123")
.putEmail("support@rudderstack.com24"),
option
)
• You need to use the same putCustomContext API in iOS.
Hope this will unblock you for now!
CC: <!subteam^S04QT1G74Q3|@sdk-team>damp-napkin-69254
06/05/2023, 9:04 PMdamp-napkin-69254
06/05/2023, 9:05 PMcalm-yak-10773
06/06/2023, 9:42 PMalert-shampoo-49789
07/26/2023, 1:46 PMcalm-yak-10773
07/26/2023, 2:00 PMalert-shampoo-49789
07/26/2023, 2:08 PMcalm-yak-10773
07/26/2023, 2:18 PMWe aren’t able to self host a control panelDoes it mean you are using our hosted control plane? If that’s the case, you can utilise the transformation feature, right? Or is there any blocker?
alert-shampoo-49789
07/26/2023, 2:33 PMcalm-yak-10773
07/26/2023, 2:43 PMalert-shampoo-49789
07/26/2023, 4:10 PMcalm-yak-10773
07/26/2023, 4:43 PMalert-shampoo-49789
07/26/2023, 4:54 PMcalm-yak-10773
07/26/2023, 4:57 PM