Getting Started
ReferralHero Flutter/Dart SDK
Getting started
To start using the ReferralHero SDK, you will need to add it to your project as a package from pub.dev.
Adding the Dependency
Step 1:
Open your Flutter project.
Add the following dependency to your
pubspec.yaml
file:
Run
flutter pub get
to fetch the new dependency.
Step 2:
Import ReferralHero in your Dart code:
Initialize the SDK in your main application file (
main.dart
):
Step 3:
Get your
API_TOKEN
from the ReferralHero Dashboard -> API: ReferralHero Dashboard.
Back in the ReferralHero overview, click to edit your desired Campaign.
Then the Installation tab, then Mobile App Installation.
Get your
UUID
: The 12-letter ID that starts with ‘MF’ in the Tracking Code, e.g. MF078d000987.
Add the Campaign Token obtained from the campaign, and UUID from the installation Tab.
Step 4:
In the Goal section of your Campaign settings, ensure you have added the Google Play and Apple App Store links and a default referral link for desktop web users.
Well done! You should now be able to build and run your campaign. Before using the more advanced features of the SDK, you should learn about a couple of important concepts.
Tracking Referrals
Now that you have implemented the SDK, you can start identifying and tracking referrals!
For that, you will need 2 things:
Universal Link
Your Integrated App
The RH SDK Pulls information from your Device, like this:
The format for screen sizes is not native to RH, and the format should be parsed to RH accepted, such as:
With this information, you should be able to add the subscriber data, with the Get Referrer, Add Subscriber, Create Pending Referral, or Track Referral methods to automatically identify or track a referral:
To further understand the implementation of these methods, please check the Public Methods section, and our Github Sample Project.
Last updated