Prerequisites
Before you get started, make sure you have the following:- Obtain your publishable key (
DUB_PUBLISHABLE_KEY) from your workspace’s Tracking settings page. - You would also want to have your custom domain (
DUB_DOMAIN) handy as well. - (Optional) If you plan to track conversions, make sure to enable conversion tracking for your links.
Quickstart
This quick start guide will show you how to get started with Dub React Native SDK in your React Native app.1
Install the Dub React Native SDK
2
Initialize the SDK
You must call Option 2: Manually initialize the Dub SDK
init on your dub instance with your publishable key and domain prior to being able to use the dub instance. We provide two ways to initialize the SDK:Option 1: Use the DubProvider to wrap your appTrack deep link open events
Call
trackOpen on the dub instance to track deep link and deferred deep link open events.
The trackOpen function should be called once without a deepLink parameter on first launch, and then
again with the deepLink parameter whenever the app is opened from a deep link.React Native
4
Track lead events (optional)
To track lead events, call
trackLead on the dub instance with your customer’s external ID, name, and email.React Native
Lead event attributes
Lead event attributes
Here are the properties you can include when sending a lead event:
5
Track sale events (optional)
To track sale events, call
trackSale on the dub instance with your customer’s user ID and purchase information.React Native
Sale event attributes
Sale event attributes
Here are the properties you can include when sending a sale event:
Examples
Here are some open-source code examples that you can reference:React Native
See the full example on GitHub.