App Bundle Id : Every app has a unique application ID that looks like com.example.myapp. This id uniquely identifies the app on the device and also on the app store.
(Know more about bundle ids here)
The list of events to setup triggers and track goals, user properties that allows to personalize messages and to target better.
(Read more on how you can setup here)
Note
If you are already using a separate analytics class where you are sending events to different platforms from a single place it is much faster to use our tracking guide to complete event logging to setup triggers and track goals.
In case you are logging events to third parties after each interaction, please use our Third party API guide to migrate all the events that you are sending to one of the supported third parties as listed in the guide.
Getting started with Apxor iOS
Apxor provides you easy to use plugins for your Actions. They are:
Install CocoaPods, if you don't already have it. CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 95 thousand libraries and is used in over 3 million apps. CocoaPods can help you scale your projects elegantly. If you don't want to use CocoaPods, you can install ApxorSDK manually.
If this is your first pod, run pod init. Add the following to the corresponding target in your Podfile and run pod install.
use_frameworks!
pod 'Apxor-Core', '2.10.36'
pod 'Apxor-CE', '1.05.25'
pod 'Apxor-Push', '1.01.01'
pod 'Apxor-RTA', '1.09.39'
pod 'Apxor-WYSIWYG', '1.02.71'
pod 'Apxor-Survey', '1.04.18'
Initialize Apxor iOS SDK
Auto initialize SDK (Recommended)
To Auto initialize SDK (Recommended), add the following inside your application plist file.
Open your application's Info.plist as source code.
Copy paste the below piece of code, to create an entry for ApxorSDK.
To get your app ID, please email us at contact@apxor.com
Configuring Test Device
First, you need to configure your app to ensure there is a URL Scheme with your application's bundle identifier as the value.
If your app already has a URL Scheme with your application's bundle identifier as the value, you can skip this step.
Configure URL Scheme
To configure URL scheme, goto your project settings, select Targets. Click on the Info tab.
Select the URL Types, and click on the + button to add a new URL Scheme.
Add a new URL Scheme with your bundle identifier as the value.
Your bundle identifer will be in the format, com.xxxx.xxxx
Use the image below for reference.
Note
Make sure the URL scheme has the value of your bundle identifier that was provided in the dashboard while registering with us. Also, the app must have same bundle identifier.
Handling the deep link
Using AppDelegate
You'd need to enable Apxor to handle Apxor specific deeplinks.
In your application's AppDelegate file, in the function application(_:open:options:), add the following code at the beginning,
// Swift
/*
Apxor's code to handle deeplinks
*/
let urlStr = url.absoluteString
if (urlStr.contains("add-test-device")) {
ApxorSDK.handleDeeplink(url)
}
This will ensure the Apxor specific deep links are handle by our SDK.
Using SceneDelegate
You'd need to enable Apxor to handle Apxor specific deeplinks.
In your application's SceneDelegate file, add the following code at the beginning,
To use the push notifications feature, make sure the following lines exist in your application plist file under Apxor section.
<key>APXPushPlugin</key>
<true/>
To configure iOS Push notification via Apxor dashboard, you'd need to upload APNs Auth Key file along with it's ID (key ID), your Team ID, and your application's Bundle ID.
The APNs Auth Key is the best way to configure pushes, as you don't need to regenerate a certificate every year and also, this key can be used to configure Push notifications to sever of your applications (under the same apple developer account)
Things required to configure iOS Push notification:
Auth Key file
Key ID (usuallly the name of the Auth Key file)
Team ID (the 10 digit alphanumeric key)
Your app’s bundle ID (in the format com.abc.xyz)
See here on how to get these, Push notifications
Once you get those details, add the below code in your application's AppDelegate file in the applicationdidRegisterForRemoteNotificationsWithDeviceToken function.
import APXPushPlugin
let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }
let token = tokenParts.joined()
print("Device Token: \(token)")
APXPushPlugin.setPushDeviceToken(token)
[APXPushPlugin setPushDeviceToken:token];
The token can be passed in either the NSData or NSString format
If you haven't already used the code to Ask User for notifications permission, add the following function in your AppDelegate file.
For using Apxor Embedded Cards the versions of the following plugins should be greater than or equal the ones mentioned below
Core: 2.10.26
RTA: 1.09.26
CE: 1.05.16
WYSIWYG: 1.02.67
For using Apxor's immersive template embedded cards, this step is necessary.
In all areas of the app where you may want to show an in-line widget, insert the following code in the view controller:
// Swiftlet EmbedCard = APXRTAPlugin.initEmbedCard(withId:<Tag>)!// you can add it in a UIStackView (recommended)let stackView =UIStackView()stackView.addArrangedSubview(EmbedCard)// add your other existing views if anystackView.addArrangedSubview(existingView1)..// if you want to add it in a UIViewlet sampleView =UIView()sampleView.addSubview(EmbedCard)// add constraints (optional)EmbedCard.translatesAutoresizingMaskIntoConstraints =falseEmbedCard.topAnchor.constraint(equalTo: sampleView.topAnchor).isActive =trueEmbedCard.leadingAnchor.constraint(equalTo: sampleView.leadingAnchor).isActive =trueEmbedCard.bottomAnchor.constraint(equalTo: sampleView.bottomAnchor).isActive =trueEmbedCard.trailingAnchor.constraint(equalTo: sampleView.trailingAnchor).isActive =true
// Objective-C
APXEmbedCard *embedCard = [APXRTAPlugin initEmbedCardWithId: <Tag>];
// you can add it in a UIStackView (recommended)
UIStackView *stackView = [[UIStackView alloc] init];
[stackView addArrangedSubview:embedCard];
// add your other existing views if any
[stackView addArrangedSubview:existingView1];
.
.
// if you want to add it in a UIView
UIView *sampleView = [[UIView alloc] init];
[sampleView addSubview:embedCard];
// add constraints (optional)
embedCard.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[
[embedCard.topAnchor constraintEqualToAnchor:sampleView.topAnchor],
[embedCard.leadingAnchor constraintEqualToAnchor:sampleView.leadingAnchor],
[embedCard.bottomAnchor constraintEqualToAnchor:sampleView.bottomAnchor],
[embedCard.trailingAnchor constraintEqualToAnchor:sampleView.trailingAnchor]
]];
Rename <Tag> to any unique ID (any positive Integer). Ensure that you keep the ID unique across different IDs and across different Embed Card instances.
Story Slot
Note
For using Apxor Stories the versions of the following plugins should be greater than or equal the ones mentioned below
Core: 2.10.26
RTA: 1.09.26
CE: 1.05.16
WYSIWYG: 1.02.67
In all areas of the app where you may want to show an in-line widget, insert the following code in the view controller:
// Swiftlet StoryWidget = APXRTAPlugin.initStories(withId:<Tag>)!// you can add it in a UIStackView (recommended)let stackView =UIStackView()stackView.addArrangedSubview(StoryWidget)// add your other existing views if anystackView.addArrangedSubview(existingView1)..// if you want to add it in a UIViewlet sampleView =UIView()sampleView.addSubview(StoryWidget)// add constraints (optional)StoryWidget.translatesAutoresizingMaskIntoConstraints =falseStoryWidget.topAnchor.constraint(equalTo: sampleView.topAnchor).isActive =trueStoryWidget.leadingAnchor.constraint(equalTo: sampleView.leadingAnchor).isActive =trueStoryWidget.bottomAnchor.constraint(equalTo: sampleView.bottomAnchor).isActive =trueStoryWidget.trailingAnchor.constraint(equalTo: sampleView.trailingAnchor).isActive =true
// Objective-C
APXStoryGroup *storyWidget = [APXRTAPlugin initStoriesWithId:<Tag>];
// you can add it in a UIStackView (recommended)
UIStackView *stackView = [[UIStackView alloc] init];
[stackView addArrangedSubview:storyWidget];
// add your other existing views if any
[stackView addArrangedSubview:existingView1];
.
.
// if you want to add it in a UIView
UIView *sampleView = [[UIView alloc] init];
[sampleView addSubview:storyWidget];
// add constraints (optional)
storyWidget.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[
[storyWidget.topAnchor constraintEqualToAnchor:sampleView.topAnchor],
[storyWidget.leadingAnchor constraintEqualToAnchor:sampleView.leadingAnchor],
[storyWidget.bottomAnchor constraintEqualToAnchor:sampleView.bottomAnchor],
[storyWidget.trailingAnchor constraintEqualToAnchor:sampleView.trailingAnchor]
]];
Rename <Tag> to any unique ID (any positive Integer). Ensure that you keep the ID unique across different IDs and across different Stories instances.