linkrunner 0.5.5
linkrunner: ^0.5.5 copied to clipboard
Flutter Package for linkrunner, track every click, download and dropoff for your app links
linkrunner #
Flutter Package for linkrunner.io
Installation #
Step 1: Installing linkrunner #
Installing through cmdline
run the following:
flutter pub add linkrunner
OR
Manually adding dependencies
Add linkrunner
to your pubspec.yaml
under dependencies:
dependencies:
linkrunner: ^0.5.5
Then run:
flutter pub get
to install your new dependency.
Usage #
Initialisation #
You will need your project token to initialise the package.
Place it in the main
function:
import 'package:linkrunner/main.dart';
// Initialize the package
final linkrunner = LinkRunner();
void main() async {
// Call the .ensureInitialized method before calling the .init method
WidgetsFlutterBinding.ensureInitialized();
final init = await lr.init("YOUR_PROJECT_TOKEN");
runApp(MyApp());
}
Response type for linkrunner.init
{
ip_location_data: {
ip: string;
city: string;
countryLong: string;
countryShort: string;
latitude: number;
longitude: number;
region: string;
timeZone: string;
zipCode: string;
};
deeplink: string;
root_domain: boolean;
}
Trigger #
Call this function once your onboarding is completed and the main stack is loaded
import 'package:linkrunner/main.dart';
void trigger() async {
final trigger = await linkrunner.trigger(
userData: LRUserData(
id: '1',
name: 'John Doe', // optional
phone: '9583849238', // optional
email: 'support@linkrunner.io', //optional
),
data: {}, // Any other data you might need
config: TriggerConfig(
triggerDeeplink: true // true by default
)
);
}
By setting config > triggerDeeplink as true
the deeplink won't be trigged (Only set to false if you are handling the redirection by yourself)
You can pass any additional user related data in the data
attribute
Response type for linkrunner.trigger
{
ip_location_data: {
ip: string;
city: string;
countryLong: string;
countryShort: string;
latitude: number;
longitude: number;
region: string;
timeZone: string;
zipCode: string;
};
deeplink: string;
root_domain: boolean;
trigger: boolean; // Deeplink won't be triggered if false
}
Note: Value of trigger
will be only true for the first time the function is triggered by the user in order to prevent unnecessary redirects
Facing issues during integration? #
Email us at support@linkrunner.io
License #
MIT