Package | Version |
---|---|
affise_attribution_lib |
1.6.26 |
- Affise Attribution Flutter Library
- Description
- Features
- ProviderType identifiers collection
- Event send control
- Events tracking
- Custom events tracking
- Predefined event parameters
- Events buffering
- Advertising Identifier (google) tracking
- Open Advertising Identifier (huawei) tracking
- Install referrer tracking
- Push token tracking
- Reinstall Uninstall tracking
- APK preinstall tracking
- Deeplinks
- AppLinks
- Offline mode
- Disable tracking
- Disable background tracking
- Get random user Id
- Get random device Id
- Get providers
- Is first run
- Get referrer
- Get referrer value
- Get referrer on server
- Get referrer on server parameter
- Referrer keys
- Get module state
- Platform specific
- SDK to SDK integrations
- Debug
- Troubleshoots
Affise SDK is a software you can use to collect app usage statistics, device identifiers, deeplink usage, track install referrer.
Add git dependency to pubspec.yaml
in your flutter application
dependencies:
flutter:
sdk: flutter
affise_attribution_lib:
git:
url: https://github.com/affise/flutter-sdk
Affise.module.moduleStart(AffiseModules.ADVERTISING);
Get list of installed modules:
Affise.module.getModulesInstalled().then((modules) {
print("Modules: $modules");
});
Add modules to android project
Module | Version | Start |
---|---|---|
ADVERTISING |
Auto |
|
ANDROIDID |
Auto |
|
LINK |
Auto |
|
NETWORK |
Auto |
|
PHONE |
Auto |
|
STATUS |
Auto |
|
SUBSCRIPTION |
Auto |
|
RUSTORE |
Auto |
|
HUAWEI |
Auto |
Example example/android/app/build.gradle
final affise_version = '1.6.50'
dependencies {
// Affise modules
implementation "com.affise:module-advertising:$affise_version"
implementation "com.affise:module-androidid:$affise_version"
implementation "com.affise:module-link:$affise_version"
implementation "com.affise:module-network:$affise_version"
implementation "com.affise:module-phone:$affise_version"
implementation "com.affise:module-status:$affise_version"
implementation "com.affise:module-subscription:$affise_version"
// implementation "com.affise:module-rustore:$affise_version"
// implementation "com.affise:module-huawei:$affise_version"
}
Add modules to iOS project
Module | Version | Start |
---|---|---|
ADVERTISING |
1.6.42 |
Manual |
LINK |
1.6.42 |
Auto |
STATUS |
1.6.42 |
Auto |
SUBSCRIPTION |
1.6.42 |
Auto |
Example example/ios/Podfile
target 'Runner' do
# ...
# Affise Modules
pod 'AffiseModule/Advertising', `1.6.42`
pod 'AffiseModule/Link', `1.6.42`
pod 'AffiseModule/Status', `1.6.42`
pod 'AffiseModule/Subscription', `1.6.42`
end
iOS
This module required to Use IDFA
(Identifier for advertisers)
Warning
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
Module Advertising requires
NSUserTrackingUsageDescription
key ininfo.plist
Application will crash if key not present
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
Open info.plist
and add key NSUserTrackingUsageDescription
with string value. For more information read requirements
Return last url in chan of redirection
π₯Support MAX 10 redirectionsπ₯
Affise.module.linkResolve("SITE_WITH_REDIRECTION", (redirectUrl) {
// handle redirect url
});
Affise.module.getStatus(AffiseModules.STATUS, (response) {
// handle status response
});
Get products by ids:
var ids = ["exampple.product.id_1", "exampple.product.id_2"];
Affise.module.fetchProducts(ids, (result) {
if (result.isSuccess) {
var value = result.asSuccess;
List<AffiseProduct> products = value.products;
List<String> invalidIds = value.invalidIds;
} else {
String error = result.asFailure;
}
});
Purchase product:
// Specify product type for correct affise event
Affise.module.purchase(product, AffiseProductType.CONSUMABLE, (result) {
if (result.isSuccess) {
AffisePurchasedInfo purchasedInfo = result.asSuccess;
} else {
String error = result.asFailure;
}
});
CONSUMABLE
NON_CONSUMABLE
RENEWABLE_SUBSCRIPTION
NON_RENEWABLE_SUBSCRIPTION
After dependency is added, sync project with flutter pub get
and initialize.
Demo app
main.dart
import 'package:flutter/foundation.dart';
import 'package:affise_attribution_lib/affise.dart';
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
Affise
.settings(
affiseAppId: "Your appId", //Change to your app id
secretKey: "Your SDK secretKey", //Change to your SDK secretKey
)
.start(); // Start Affise SDK
}
}
Check if library is initialized
Affise.isInitialized();
Warning
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
Please make sure your credentials are valid
Visit section validation credentials
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
Set SDK server domain:
Affise
.settings(
affiseAppId: "Your appId",
secretKey: "Your SDK secretKey",
)
.setProduction(false)
.setDomain("https://YoureCustomDomain/") // Set custom domain
.start(); // Start Affise SDK
Minimal Android SDK version is 21
Example example/android/app/build.gradle
android {
defaultConfig {
minSdkVersion Math.max(flutter.minSdkVersion, 21)
}
}
For a minimal working functionality your app needs to declare internet permission:
<manifest>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
OAID certificate in your project example/android/app/src/main/assets/oaid.cert.pem
Affise SDK uses AppTrackingTransparency
framework to get advertisingIdentifier
For working functionality your app needs to declare NSUserTrackingUsageDescription
permission:
Open XCode project info.plist
and add key NSUserTrackingUsageDescription
with string value
Example info.plist
:
<plist version="1.0">
<dict>
...
<key>NSUserTrackingUsageDescription</key>
<string>Youre permission text</string>
</dict>
To match users with events and data library is sending, these ProviderType
identifiers are collected:
AFFISE_APP_ID
AFFISE_PKG_APP_NAME
AFF_APP_NAME_DASHBOARD
APP_VERSION
APP_VERSION_RAW
STORE
TRACKER_TOKEN
TRACKER_NAME
FIRST_TRACKER_TOKEN
FIRST_TRACKER_NAME
LAST_TRACKER_TOKEN
LAST_TRACKER_NAME
OUTDATED_TRACKER_TOKEN
INSTALLED_TIME
FIRST_OPEN_TIME
INSTALLED_HOUR
FIRST_OPEN_HOUR
INSTALL_FIRST_EVENT
INSTALL_BEGIN_TIME
INSTALL_FINISH_TIME
REFERRER_INSTALL_VERSION
REFERRAL_TIME
REFERRER_CLICK_TIME
REFERRER_CLICK_TIME_SERVER
REFERRER_GOOGLE_PLAY_INSTANT
CREATED_TIME
CREATED_TIME_MILLI
CREATED_TIME_HOUR
UNINSTALL_TIME
REINSTALL_TIME
LAST_SESSION_TIME
CPU_TYPE
HARDWARE_NAME
DEVICE_MANUFACTURER
DEEPLINK_CLICK
DEVICE_ATLAS_ID
AFFISE_DEVICE_ID
AFFISE_ALT_DEVICE_ID
ANDROID_ID
ANDROID_ID_MD5
REFTOKEN
REFTOKENS
REFERRER
USER_AGENT
MCCODE
MNCODE
REGION
COUNTRY
LANGUAGE
DEVICE_NAME
DEVICE_TYPE
OS_NAME
PLATFORM
SDK_PLATFORM
API_LEVEL_OS
AFFISE_SDK_VERSION
OS_VERSION
RANDOM_USER_ID
AFFISE_SDK_POS
TIMEZONE_DEV
AFFISE_EVENT_NAME
AFFISE_EVENT_TOKEN
LAST_TIME_SESSION
TIME_SESSION
AFFISE_SESSION_COUNT
LIFETIME_SESSION_COUNT
AFFISE_DEEPLINK
AFFISE_PART_PARAM_NAME
AFFISE_PART_PARAM_NAME_TOKEN
AFFISE_APP_TOKEN
LABEL
AFFISE_SDK_SECRET_ID
UUID
AFFISE_APP_OPENED
PUSHTOKEN
AFFISE_EVENTS_COUNT
AFFISE_SDK_EVENTS_COUNT
AFFISE_METRICS_EVENTS_COUNT
AFFISE_INTERNAL_EVENTS_COUNT
IS_ROOTED
IS_EMULATOR
GAID_ADID
GAID_ADID_MD5
OAID
OAID_MD5
ADID
ALTSTR_ADID
FIREOS_ADID
COLOROS_ADID
MAC_SHA1
MAC_MD5
CONNECTION_TYPE
PROXY_IP_ADDRESS
NETWORK_TYPE
ISP
There are two ways to send events
- Cache event to later scheduled send in batch
AddToCartEvent()
.send();
- Send event right now
AddToCartEvent()
.sendNow(() {
// handle event send success
}, (status) {
// handle event send failed
// π₯Warningπ₯: event is NOT cached for later send
});
For example, we want to track what items usually user adds to shopping cart. To send event first create it with following code
import 'package:affise_attribution_lib/affise.dart';
class Presenter {
void onUserAddsItemsToCart(String item) {
Map<String, dynamic> items = {
"items": "cookies, potato, milk",
};
AddToCartEvent(userData: "groceries")
.addPredefinedObject(PredefinedObject.CONTENT, items)
.send(); // Send event
}
}
With above example you can implement other events:
AchieveLevel
AddPaymentInfo
AddToCart
AddToWishlist
AdRevenue
ClickAdv
CompleteRegistration
CompleteStream
CompleteTrial
CompleteTutorial
Contact
ContentItemsView
CustomizeProduct
DeepLinked
Donate
FindLocation
InitiateCheckout
InitiatePurchase
InitiateStream
Invite
LastAttributedTouch
Lead
ListView
Login
OpenedFromPushNotification
Order
OrderItemAdded
OrderItemRemove
OrderCancel
OrderReturnRequest
OrderReturnRequestCancel
Purchase
Rate
ReEngage
Reserve
Sales
Schedule
Search
Share
SpendCredits
StartRegistration
StartTrial
StartTutorial
SubmitApplication
Subscribe
TravelBooking
UnlockAchievement
Unsubscribe
Update
ViewAdv
ViewCart
ViewContent
ViewItem
ViewItems
InitialSubscription
InitialTrial
InitialOffer
ConvertedTrial
ConvertedOffer
TrialInRetry
OfferInRetry
SubscriptionInRetry
RenewedSubscription
FailedSubscriptionFromRetry
FailedOfferFromRetry
FailedTrialFromRetry
FailedSubscription
FailedOfferise
FailedTrial
ReactivatedSubscription
RenewedSubscriptionFromRetry
ConvertedOfferFromRetry
ConvertedTrialFromRetry
Unsubscription
Use any of custom events if default doesn't fit your scenario:
CustomId01Event
CustomId02Event
CustomId03Event
CustomId04Event
CustomId05Event
CustomId06Event
CustomId07Event
CustomId08Event
CustomId09Event
CustomId10Event
If above event functionality still limits your usecase, you can use UserCustomEvent
UserCustomEvent(eventName: "MyCustomEvent")
.send();
To enrich your event with another dimension, you can use predefined parameters for most common cases. Add it to any event:
import 'package:affise_attribution_lib/affise.dart';
class Presenter {
void onUserAddsItemsToCart(String item) {
Map<String, dynamic> items = {
"items": "cookies, potato, milk",
};
AddToCartEvent(
timeStampMillis: DateTime.now().millisecondsSinceEpoch,
)
.addPredefinedString(PredefinedString.DESCRIPTION, "best before 2029")
.addPredefinedObject(PredefinedObject.CONTENT, items)
.send(); // Send event
}
}
In examples above PredefinedParameters.DESCRIPTION
and PredefinedObject.CONTENT
is used, but many others is available:
PredefinedParameter | Type | Event Method |
---|---|---|
PredefinedString | String | addPredefinedString() |
PredefinedLong | int | addPredefinedLong() |
PredefinedFloat | double | addPredefinedFloat() |
PredefinedObject | Map<String, dynamic> | addPredefinedObject() |
PredefinedListObject | List<Map<String, dynamic>> | addPredefinedListObject() |
PredefinedListString | List<String> | addPredefinedListString() |
ACHIEVEMENT_ID
ADREV_AD_TYPE
BRAND
BRICK
CAMPAIGN_ID
CATALOGUE_ID
CHANNEL_TYPE
CITY
CLASS
CLICK_ID
CONTENT_ID
CONTENT_NAME
CONTENT_TYPE
CONVERSION_ID
COUNTRY
COUPON_CODE
CURRENCY
CUSTOMER_SEGMENT
CUSTOMER_TYPE
CUSTOMER_USER_ID
DEEP_LINK
DESCRIPTION
DESTINATION_A
DESTINATION_B
DESTINATION_LIST
EVENT_NAME
NEW_VERSION
NETWORK
OLD_VERSION
ORDER_ID
PARAM_01
PARAM_02
PARAM_03
PARAM_04
PARAM_05
PARAM_06
PARAM_07
PARAM_08
PARAM_09
PARAM_10
PAYMENT_INFO_AVAILABLE
PID
PLACEMENT
PREFERRED_NEIGHBORHOODS
PRODUCT_ID
PRODUCT_NAME
PURCHASE_CURRENCY
RECEIPT_ID
REGION
REGISTRATION_METHOD
REVIEW_TEXT
SEARCH_STRING
SEGMENT
SOURCE
STATUS
SUBSCRIPTION_ID
SUCCESS
SUGGESTED_DESTINATIONS
SUGGESTED_HOTELS
TUTORIAL_ID
UNIT
UTM_CAMPAIGN
UTM_MEDIUM
UTM_SOURCE
VALIDATED
VERTICAL
VIRTUAL_CURRENCY_NAME
VOUCHER_CODE
AMOUNT
DATE_A
DATE_B
DEPARTING_ARRIVAL_DATE
DEPARTING_DEPARTURE_DATE
HOTEL_SCORE
LEVEL
MAX_RATING_VALUE
NUM_ADULTS
NUM_CHILDREN
NUM_INFANTS
PREFERRED_NUM_STOPS
PREFERRED_STAR_RATINGS
QUANTITY
RATING_VALUE
RETURNING_ARRIVAL_DATE
RETURNING_DEPARTURE_DATE
SCORE
TRAVEL_START
TRAVEL_END
USER_SCORE
EVENT_START
EVENT_END
PREFERRED_PRICE_RANGE
PRICE
REVENUE
LAT
LONG
CONTENT
CONTENT_LIST
CONTENT_IDS
Affise library will send any pending events with first opportunity, but if there is no network connection or device is disabled, events are kept locally for 7 days before deletion.
Advertising Identifier (google) tracking is supported automatically, no actions needed
Open Advertising Identifier is supported automatically, no actions needed
Install referrer tracking is supported automatically, no actions needed
To let affise track push token you need to receive it from your push service provider, and pass to Affise library. First add firebase integration to your app completing these steps: Firebase iOS or Android Docs
After you have done with firebase integration, add to your cloud messaging service onNewToken
method Affise.addPushToken(token)
import 'package:affise_attribution_lib/affise.dart';
void saveToken(String token) {
Affise.addPushToken(token);
}
class _Application extends State<Application> {
String _token;
Future<void> setupToken() async {
// Get the token each time the application loads
String? token = await FirebaseMessaging.instance.getToken();
// Any time the token refreshes, store this in the database too.
FirebaseMessaging.instance.onTokenRefresh.listen(saveToken);
}
@override
void initState() {
super.initState();
setupToken();
}
@override
Widget build(BuildContext context) {
return Text("...");
}
}
Affise automatically track reinstall events by using silent-push technology, to make this feature work, pass push token when it is recreated by user and on you application starts up
Affise.addPushToken("token");
SDK is also supports scenario when APK is installed not from one of application markets, such as google play, huawei appgallery or amazon appstore
To use this feature, create file with name partner_key
in your app assets directory, and write unique identifier inside, this key will be passed to our backend so you can track events by partner later in your Affise console.
Warning
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
Deeplinks support only CUSTOM scheme NOT
http
orhttps
For
http
orhttps
read how to setup AppLinksπ₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
To integrate deeplink support you need:
-
Register deeplink callback right after
Affise.settings(..).start()
void init() {
Affise.settings(affiseAppId, secretKey).start(); // Start Affise SDK
Affise.registerDeeplinkCallback((value) {
// full uri "scheme://host/path?parameters"
var deeplink = value.deeplink;
// separated for convenience
var scheme = value.scheme;
var host = value.host;
var path = value.path;
var queryParametersMap = value.parameters;
if(queryParametersMap["<your_uri_key>"]?.contains("<your_uri_key_value>") == true) {
// handle value
}
});
}
Test Android DeepLink via terminal command:
adb shell am start -a android.intent.action.VIEW -d "YOUR_SCHEME://YOUR_DOMAIN/somepath?param=1\&list=some\&list=other\&list="
Test iOS DeepLink via terminal command:
xcrun simctl openurl booted "YOUR_SCHEME://YOUR_DOMAIN/somepath?param=1&list=some&list=other&list=1"
To integrate deeplink support in android you need:
-
Add intent filter to one of your activities
AndroidManifest.xml example
-
Add custom scheme (NOT
http
orhttps
) and host to filter
Example: YOUR_SCHEME://YOUR_DOMAIN
Example: myapp://mydomain.com
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="YOUR_DOMAIN"
android:scheme="YOUR_SCHEME" />
</intent-filter>
To integrate deeplink support in iOS you need:
Add key CFBundleURLTypes
to Info.plist
example Info.plist
Example: YOUR_SCHEME://YOUR_DOMAIN
Example: myapp://mydomain.com
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>YOUR_DOMAIN</string>
<key>CFBundleURLSchemes</key>
<array>
<string>YOUR_SCHEME</string>
</array>
</dict>
</array>
Warning
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
You must owne website domain.
And has ability to add file
https://yoursite/.well-known/apple-app-site-association
for iOS supportAnd has ability to add file
https://yoursite/.well-known/assetlinks.json
for Android supportπ₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
To integrate applink support in android you need:
-
Add intent filter to one of your activities
AndroidManifest.xml example
-
Add
https
orhttp
scheme and host to filter
Example: https://YOUR_DOMAIN
Example: https://mydomain.com
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="YOUR_DOMAIN"
android:scheme="https" />
</intent-filter>
-
Associate your app with your website. Read Google instructions
How To Associate your app with your website
After setting up URL support for your app, the App Links Assistant generates a Digital Assets Links file you can use to associate your website with your app.
As an alternative to using the Digital Asset Links file, you can associate your site and app in Search Console.
If you're using Play App Signing for your app, then the certificate fingerprint produced by the App Links Assistant usually doesn't match the one on users' devices. In this case, you can find the correct Digital Asset Links JSON snippet for your app in your Play Console developer account under Release > Setup > App signing.
To associate your app and your website using the App Links Assistant, click Open Digital Asset Links File Generator from the App Links Assistant and follow these steps:
Figure 2. Enter details about your site and app to generate a Digital Asset Links file.
-
Enter your Site domain and your Application ID.
-
To include support in your Digital Asset Links file for One Tap sign-in, select Support sharing credentials between the app and the website and enter your site's sign-in URL.This adds the following string to your Digital Asset Links file declaring that your app and website share sign-in credentials:
delegate_permission/common.get_login_creds
. -
Specify the signing config or select a keystore file.
Make sure you select the right release config or keystore file for the release build or the debug config or keystore file for the debug build of your app. If you want to set up your production build, use the release config. If you want to test your build, use the debug config.
- Click Generate Digital Asset Links file.
- Once Android Studio generates the file, click Save file to download it.
- Upload the
assetlinks.json
file to your site, with read access for everyone, athttps://yoursite/.well-known/assetlinks.json
.
Important
The system verifies the Digital Asset Links file via the encrypted HTTPS protocol. Make sure that the assetlinks.json file is accessible over an HTTPS connection, regardless of whether your app's intent filter includes https.
- Click Link and Verify to confirm that you've uploaded the correct Digital Asset Links file to the correct location.
Learn more about associating your website with your app through the Digital Asset Links file in Declare website associations.
-
To integrate applink support in iOS you need:
-
Follow how to set up applink in the official documentation.
-
Associate your app with your website. Supporting associated domains
-
Add key
com.apple.developer.associated-domains
toInfo.plist
Example: https://YOUR_DOMAIN
Example: https://mydomain.com
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:YOUR_DOMAIN</string>
</array>
In some scenarios you would want to limit Affise network usage, to pause that activity call anywhere in your application following code after Affise start:
Affise.settings(affiseAppId, secretKey).start(); // Start Affise SDK
Affise.setOfflineModeEnabled(true); // to enable offline mode
Affise.setOfflineModeEnabled(false); // to disable offline mode
While offline mode is enabled, your metrics and other events are kept locally, and will be delivered once offline mode is disabled. Offline mode is persistent as Application lifecycle, and will be disabled with process termination automatically. To check current offline mode status call:
Affise.isOfflineModeEnabled(); // returns true or false describing current tracking state
To disable any tracking activity, storing events and gathering device identifiers and metrics call anywhere in your application following code after Affise start:
Affise.settings(affiseAppId, secretKey).start(); // Start Affise SDK
Affise.setTrackingEnabled(true); // to enable tracking
Affise.setTrackingEnabled(false); // to disable tracking
By default tracking is enabled.
While tracking mode is disabled, metrics and other identifiers is not generated locally. Keep in mind that this flag is persistent until app reinstall, and don't forget to reactivate tracking when needed. To check current status of tracking call:
Affise.isTrackingEnabled(); // returns true or false describing current tracking state
To disable any background tracking activity, storing events and gathering device identifiers and metrics call anywhere in your application following code after Affise start:
Affise.settings(affiseAppId, secretKey).start(); // Start Affise SDK
Affise.setBackgroundTrackingEnabled(true); // to enable background tracking
Affise.setBackgroundTrackingEnabled(false); // to disable background tracking
By default background tracking is enabled.
While background tracking mode is disabled, metrics and other identifiers is not generated locally. Background tracking mode is persistent as Application lifecycle, and will be re-enabled with process termination automatically. To check current status of background tracking call:
Affise.isBackgroundTrackingEnabled(); // returns true or false describing current background tracking state
Affise.getRandomUserId();
Affise.getRandomDeviceId();
Returns providers map with ProviderType as key
Affise.getProviders().then((providers) {
var key = ProviderType.AFFISE_APP_TOKEN;
var value = providers[key];
});
Affise.isFirstRun().then((isFirstRun) {
// handle
});
Use the next public method of SDK
To get Install referrer by installing from
Android
RuStore
include moduleRuStore
To get Install referrer by installing from
Android
AppGallery
include moduleHuawei
Affise.getReferrerUrl((value) {
// handle referrer
});
Use the next public method of SDK to get referrer value by
To get Install referrer by installing from
Android
RuStore
include moduleRuStore
To get Install referrer by installing from
Android
AppGallery
include moduleHuawei
Affise.getReferrerUrlValue(ReferrerKey.CLICK_ID, (value) {
// handle referrer
});
iOS Only
Note
Requires Affise Status Module for ios
Use the next public method of SDK
Affise.ios.getReferrerOnServer((value) {
// handle referrer
});
iOS Only
Note
Requires Affise Status Module for ios
Use the next public method of SDK to get referrer parameter by
Affise.ios.getReferrerOnServerValue(ReferrerKey.CLICK_ID, (value) {
// handle referrer value
});
In examples above ReferrerKey.CLICK_ID
is used, but many others is available:
AD_ID
CAMPAIGN_ID
CLICK_ID
AFFISE_AD
AFFISE_AD_ID
AFFISE_AD_TYPE
AFFISE_ADSET
AFFISE_ADSET_ID
AFFISE_AFFC_ID
AFFISE_CHANNEL
AFFISE_CLICK_LOOK_BACK
AFFISE_COST_CURRENCY
AFFISE_COST_MODEL
AFFISE_COST_VALUE
AFFISE_DEEPLINK
AFFISE_KEYWORDS
AFFISE_MEDIA_TYPE
AFFISE_MODEL
AFFISE_OS
AFFISE_PARTNER
AFFISE_REF
AFFISE_SITE_ID
AFFISE_SUB_SITE_ID
AFFISE_SUB_1
AFFISE_SUB_2
AFFISE_SUB_3
AFFISE_SUB_4
AFFISE_SUB_5
AFFC
PID
SUB_1
SUB_2
SUB_3
SUB_4
SUB_5
Affise.module.getStatus(AffiseModules.STATUS, (response) {
// handle status response
});
Android Only
Under the EU's General Data Protection Regulation (GDPR): An individual has the right to have their personal data erased. To provide this functionality to user, as the app developer, you can call
Affise.settings(affiseAppId, secretKey).start(); // Start Affise SDK
Affise.android.forget(); // to forget users data
After processing such request our backend servers will delete all users data. To prevent library from generating new events, disable tracking just before calling Affise.forget:
Affise.settings(affiseAppId, secretKey).start(); // Start Affise SDK
Affise.setTrackingEnabled(false);
Affise.android.forget(); // to forget users data
iOS Only
For ios prior 16.1
first call
Affise.ios.registerAppForAdNetworkAttribution((error) {
// Handle error
});
Updates the fine and coarse conversion values, and calls a completion handler if the update fails. Second argument coarseValue is available in iOS 16.1+
Affise.ios.updatePostbackConversionValue(1, SKAdNetwork.CoarseConversionValue.medium, (error) {
// Handle error
});
Configure your app to send postback copies to Affise:
Add key NSAdvertisingAttributionReportEndpoint
to Info.plist
Set key value to https://affise-skadnetwork.com/
Example: example/ios/Runner/Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>NSAdvertisingAttributionReportEndpoint</key>
<string>https://affise-skadnetwork.com/</string>
</dict>
</array>
// Send AdRevenue info
AffiseAdRevenue(AffiseAdSource.ADMOB)
.setRevenue(2.5, "ImpressionData_Currency")
.setNetwork("ImpressionData_Network")
.setUnit("ImpressionData_Unit")
.setPlacement("ImpressionData_Placement")
.send();
Warning
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
Debug methods WON'T work on Production
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
Validate your credentials by receiving ValidationStatus
values:
VALID
- your credentials are validINVALID_APP_ID
- your app id is not validINVALID_SECRET_KEY
- your SDK secretKey is not validPACKAGE_NAME_NOT_FOUND
- your application package name not foundNOT_WORKING_ON_PRODUCTION
- you using debug method on productionNETWORK_ERROR
- network or server not available (for exampleAiroplane mode
is active)
Affise
.settings(
affiseAppId: "Your appId",
secretKey: "Your SDK secretKey",
)
.setProduction(false) //To enable debug methods set Production to false
.start(); // Start Affise SDK
Affise.debug.validate((status) {
// Handle validation status
});
Warning
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
This app has crashed because Affise Advertising Module is attempted to access privacy-sensitive data without a usage description.
The app's
Info.plist
must contain anNSUserTrackingUsageDescription
key with a string value explainingto the user how the app uses this data.
π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯π₯
Open info.plist
and add key NSUserTrackingUsageDescription
with string value. For more information read requirements