Set up your device mode destination in RudderStack.
Note that:
To set up a device mode destination, choose the connection mode as Device mode while configuring your destination.
In some cases, setting up a device mode destination involves enabling the Use device mode to send events toggle while configuring the destination.
You can change the connection mode after the destination is set up. Go to the destination’s Configuration tab and click Edit configuration.
Some destinations support only device mode. See the destination-specific documentation for the supported connection modes.
Go to Collect > Transformations and select the transformation to connect to this destination.
Device mode transformations can be enabled only from the Transformations tab.
Click the Connections tab . If you don’t have any destinations connected to it, click Connect Destination. If the transformation already has connected destinations, click Manage destinations.
Depending on whether the destination you set up (in Step 1) is already connected to some transformation, there are two ways to add a device mode transformation to it:
If your destination is not connected to any transformation click Connect. You will see a fly window with these options:
If your destination is already connected to some other transformation, click the Edit connections button to switch your transformation. See Switch transformation for more information. Once you switch the transformation, you will see the above options to enable the device mode transformation.
Configure the following settings under Device Mode:
Under Cloud Mode, the Connect to transformation toggle is enabled by default. Do not disable this toggle as it will not allow you to configure any device mode transformation settings.
Enable the Connect to transformation toggle.
Enable the Propagate errors toggle depending on your requirement.
Note that:
If Propagate errors is enabled, RudderStack sends the events to the destination without transforming the events, for any transformation errors. This is helpful in preventing data loss in case of transformation code or runtime errors.
If your transformation involves hashing PII, enabling this setting will send the untransformed event data in case of any transformation errors.
Click Save to confirm the settings and for the changes to take effect.
To confirm that the device mode transformation is connected, go to the Connections tab of your transformation and check the Connection Mode column:
Install the Android SDK following the detailed steps mentioned in Installing the Android SDK section. Additionally, use the following dependency in the Android app level build.gradle:
Install the iOS SDK following the detailed steps mentioned in Installing the iOS SDK section. Additionally, use the following dependency in Podfile:
pod'Rudder','1.17.0'
Tokenization
RudderStack provides the tokenization feature in device mode transformations to add an extra layer of security. The token is available as a metadata in the transformation and you can validate it before attaching with the RudderStack SDK.
A sample code to access the token in the transformation:
exportfunctiontransformEvent(event,metadata){constdmtToken=metadata(event)["Custom-Authorization"];//verify the token
...returnevent;}
You can use the following methods to attach the token (in the string format) to the SDK:
rudderanalytics.setAuthToken("my-token");
RudderClient.putAuthToken("my-token")
[RSClientputAuthToken:@"my-token"];
You can call these methods multiple times.
RudderStack clears the token when the user logs out, that is, when the reset() API is called.
Both the cloud and device mode events: By default, the transformation is applied to both the cloud and device mode events.
Only device mode events: Access the mode field in your transformation’s event metadata and check if its value is deviceMode. Then, specify the transformation logic to be applied to the device mode events:
Only cloud mode events: Return the device mode events as it is using the mode field and specify the transformation logic for the rest of the events (cloud mode events), as shown:
RudderStack provides the Client Transformation service to facilitate transformations for device mode destinations. It ensures that the event ingestion to RudderStack backend isn’t affected, assuring minimum response time from the RudderStack backend.
RudderStack SDK sends the event to the Client Transformation service. It multiplexes the event for different destinations and connects with the transformations attached to these device mode destinations.
Client Transformation service sends the event to the RudderStack Transformation service to transform the event according to the functions defined in the attached transformations.
After the transformation is applied, the transformed event is returned to the Client Transformation service.
Client Transformation service responds to the SDK with the transformed events for all the destinations.
Finally, the SDK parses the transformed events and forwards them to the specified device-mode destinations.
If the request to the Client Transformation service fails, the RudderStack SDK makes three retry attempts. If it fails, the SDK forwards the untransformed events to the destination or drops them - based on the Propagate errors toggle while configuring the device mode transformation (see Step 6).
Limitations
The following limitations are applicable when invoking a transformation in device mode:
The native destination SDKs might persist some captured data - mainly identifiers and traits. So, in device/hybrid mode, you cannot transform these fields using device mode transformations.
Network unavailability can lead to higher latency than expected while sending the events to the destinations. RudderStack doesn’t lose data due to the network loss and stores the events in the client device until they are successfully delivered to the destination.
The iOS SDK does not support the background processing of an event when the app is closed. However, it sends the pending events the next time the app is opened.
The transformation must follow the below memory and time limits:
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.