Send events to Sprig using RudderStack web device mode.
3 minute read
RudderStack lets you send your event data to Sprig via web device mode, that is, using the native Sprig web SDK.
Find the open source code for this destination in the GitHub repository.
Add mobile device mode integration
Once you add Sprig as a destination in the RudderStack dashboard, follow these steps to add it to your mobile project depending on your integration platform:
Pass the instance of ViewController to RudderSprigFactory as shown:
Sprig requires this step to display the survey. You can also set it as nil to clear the values.
classViewController:UIViewController{overridefuncviewDidLoad(){super.viewDidLoad()// Do any additional setup after loading the view.// Pass ViewController instance to RudderSprigFactory. As Sprig SDK requires this to display the survey.RudderSprigFactory.instance.setViewController(self)}}
Sprig requires this step to display the survey. You can also set it as null to clear the values.
classMainActivity:AppCompatActivity(){overridefunonStart(){super.onStart()// pass the FragmentActivity instance, it is required by Sprig to display the survey.
SprigIntegrationFactory.FACTORY.setFragmentActivity(this@MainActivity)}}
Identify
You can use the identify call to identify a user in Sprig.
If you send a track event called Signed Out, then RudderStack automatically maps it to the logoutUser event before sending it to Sprig. Otherwise, it maps the following event/properties to the corresponding Sprig fields:
RudderStack property
Sprig property
event Required
eventName
userId
userId
properties
properties
Sprig expects the event name to be present in the eventName key. Hence, if you send a track event named Product Added, RudderStack maps it to Sprig’s eventName key before sending it across to Sprig.
To display the survey, you must pass the ViewController instance for iOS and the FragmentActivity instance for Android, otherwise the survey won’t be displayed.
If you do not want to display the survey, you can skip setting FragmentActivity or ViewController. RudderStack then forwards the call to the Sprig.track API instead of Sprig.trackAndPresent.
Reset
The reset method resets the previously identified user and related information.
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.