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.
Want to test your app before going live? Use the publishable key from a
staging workspace to track test events without affecting your
production analytics.
Quickstart
This quick start guide will show you how to get started with Dub React Native SDK in your React Native app.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
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:
Examples
Here are some open-source code examples that you can reference:React Native
See the full example on GitHub.