AppSamurai Attribution SDK targets iOS 10 or higher.
AppSamurai Attribution SDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ASAttributionSDK'
It is also required to set Always Embed Swift Libraries
to Yes
from Build Settings
for projects written in Objective-C
Application needs to import related modules to use ASAttributionSDK. Add following lines to import
’s to achieve this;
import ASAttributionSDK
@import ASAttributionSDK;
You can check version of SDK with getSDKVersion
method
ASAttribution.getSDKVersion()
[ASAttribution getSDKVersion];
ASAttributionSDK is required for tracking. Application cannot track any information before ASAttributionSDK initialization is complete.
In application’s didFinishLaunchingWithOptions
callback, call ASAttribution.initialize
function with applicationId
parameter. This parameter should be your application id from AppSamurai User Dashboard, you can use your application id for integration purposes. Check following code for sample;
ASAttribution.initialize(applicationId: "your-user-id")
[ASAttribution initialize:@"your-user-id"];
ASAttributionSDK logging level can be changed with setLogLevel
after ASAttribution.initialize
call.
ASAttribution.setLogLevel(logLevel: .debug)
[ASAttribution setLogLevel:ASLogLevelDebug];
Using ASAttributionSDK, you are able to track the frequency of custom events by placing the following code piece into your own application code. You can also attach data to your events. If you are planning to attach data to your event, make sure your dictionary is JSON serializable.
ASAttribution.track("event-name")
ASAttribution.track("event-name", data: ["string-key": json-serializable-any, ...])
[ASAttribution trackWithEventName:@"event-name"];
[ASAttribution trackWithEventName:@"event-name" data:@{@"string-key": @json-serializable-any, ...}];
Sample usages can be found in the repository for both Swift and Objective C.
App Samurai Mobile Team, mobile@appsamurai.com