mautic_tracking_api 1.0.1 mautic_tracking_api: ^1.0.1 copied to clipboard
API to Monitoring and Tracking Users using Mautic for Dart and Flutter
mautic_tracking_api #
App User Monitoring and Tracking easily for Dart and Flutter using Mautic: Open Source Marketing Automation Software.
The essence of monitoring what happens in an App is similar to monitoring what happens on a website.
In short, this package use Named Screen Path (e.g. main_screen
) in your App as your page_url
field in the tracker, Named Screen Title (e.g. Home Screen
) as your page_title
field and the Contact E-mail as unique identifier. See Mautic Contact Monitoring section for detailed instructions.
This package also use native Mautic Tracking Cookies mtc_id
, mtc_sid
and mautic_device_id
to make Tracking more effective.
Made with ❤️ by Mautic Specialists at Powertic.
Install #
Add this package to your package's pubspec.yaml
file:
dependencies:
mautic_tracking_api:
Run flutter pub get
on terminal to download and install packages and import on your main.dart
:
import 'package:mautic_tracking_api/mautic_tracking_api.dart';
Usage #
Create a global instance of MauticTracking
and import this global instance on all your files.
var MauticTracking mautic;
On your main.dart
you can setting up the MauticTracking
object:
// Setting Up
void main() async {
// Start Tracking
mautic = MauticTracking(
"https://mkt.mymautic.com",
appName: "MyApp",
email: "contact@email.com",
appVersion: '1.0.0',
appBundleName: 'com.mydomain.myapp',
);
// Track App Start
await mautic.trackAppStart();
}
Setting Up #
There are some options to instantiate MauticTracking
:
MauticTracking(
this._base_url, {
this.email,
this.appName,
this.appVersion,
this.appBundleName,
this.closeConnectionAfterRequest = true,
this.userAgent =
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)',
});
These are the constructor options:
Property | Type | Required | Description |
---|---|---|---|
_base_url |
String |
Yes | Mautic Base URL |
email |
String |
No | Mautic Contact Email |
appName |
String |
No | App Name |
appVersion |
String |
No | App Version |
appBundleName |
String |
No | App Bundle Name |
closeConnectionAfterRequest |
bool |
No | Close Connection after Request |
userAgent |
String |
No | Request User Agent |
Mautic Contact Monitoring #
The act of monitoring the traffic and activity of contacts can sometimes be somewhat technical and frustrating to understand. Mautic Tracking API makes this monitoring simple and easy to configure.
Tracking Screens #
Send App Screen info to Mautic.
Method Definition:
void trackScreen(String screenPath, [String screenName]) async;
Property | Type | Required | Description |
---|---|---|---|
screenPath |
String |
Yes | Unique Screen Route Path |
screenName |
String |
No | Unique Screen Route Label |
Usage:
You can send screen tracking info only with screenPath
.
Create your screen paths using _ to separate words and always use small caps.
mautic.trackScreen("main");
You can also send screen tracking info using screenPath
and screenName
. Fell free to use space and capitalized words for Screen Name.
mautic.trackScreen("main", "Main Page");
Tracking Events #
Send App Event info to Mautic.
Method Definition:
void trackEvent(String eventKey, String eventName, String screenPath, [String screenName]) async;
Property | Type | Required | Description |
---|---|---|---|
eventKey |
String |
Yes | Unique Event Key |
eventName |
String |
Yes | Unique Event Name |
screenPath |
String |
Yes | Unique Screen Route Path |
screenName |
String |
No | Unique Screen Route Label |
Usage:
You can send screen tracking info only with screenPath
.
Create your screen paths using _ to separate words and always use small caps.
mautic.trackEvent('click_getting_start', 'Click Get Start Button', 'home');
You can also send screen tracking info using screenPath
and screenName
. Fell free to use space and capitalized words for Scren Name and Event Name.
mautic.trackEvent('click_getting_start', 'Click Get Start Button', 'home', 'Home Page');
Adding Contact Tags #
Add tag to contact.
mautic.addTag({'a', 'b'});
Property | Type | Required | Description |
---|---|---|---|
params |
Set |
Yes | Set of tag names |
Removing Contact Tags #
Remove tag to contact.
mautic.removeTag({'a', 'b'});
Property | Type | Required | Description |
---|---|---|---|
params |
Set |
Yes | Set of tag names |
Contribute #
Please file feature requests and bugs at the issue tracker.