iOS SDK
The Velocidi iOS SDK is open-source and can be found at github.com/velocidi/velocidi-ios-objc-sdk.
#
Installation#
Installation with CocoaPodsTo integrate VelocidiSDK into your Xcode project using CocoaPods, specify it in your Podfile
:
Then, run:
#
Installation with CarthageTo integrate VelocidiSDK into your Xcode project using Carthage, specify it in your Cartfile
:
Then, run carthage
to build the framework and drag the built VelocidiSDK.framework into your Xcode project.
#
RequirementsVelocidiSDK should work with any version of iOS equal or bigger than 11.0.
#
Setting up the SDKInitialize the VelocidiSDK with the necessary trackingBaseUrl
and the matchBaseUrl
URLs. Without this, VelocidiSDK will not work. We suggest doing this when the application launches.
- Swift
- Objective-C
iOS 14 IDFA access
In iOS 14 Apple introduces changes to the way the Advertising Identifier (IDFA) can be accessed. In particular, developers are forced to ask the user permission to access the IDFA:
- https://developer.apple.com/app-store/user-privacy-and-data-use/
- https://developer.apple.com/documentation/apptrackingtransparency?language=objc
The Examples folder contains two example applications ready for iOS 14, which ask for user permission before using the IDFA to execute any requests.
The Velocidi iOS SDK itself will not execute any request if the user did not allow tracking to proceed.
#
Send a track eventA tracking event will log a user action in Velocidi's CDP.
In order to send a tracking event, create an instance of VSDKTrackingEvent
. Then, call the singleton instance of VSDKVelocidi
and use the track
method.
- Swift
- Objective-C
You can also pass callback blocks that will be called when the request either succeeds or fails.
- Swift
- Objective-C
There is a big list of tracking event classes to choose from. If none of them fits the desired action, you can also create your own custom tracking event
#
Make a matchMatch requests are used to link multiple identifiers in Velocidi's CDP. This way, any action made with any of the identifiers, across multiple channels (Browser, Mobile App, ...), can be associated to the same user.
In VelocidiSDK, a match request will link the user's Advertising Identifier with other provided identifiers (like an internal ID). A typical use case for this is, for instance, during the login action, to associate the user's ID with Apple's Advertising Identifier (identifier used in all the tracking event requests).
- Swift
- Objective-C
#
Available tracking events model classesVSDKAddToCart
VSDKAppView
VSDKOrderPlace
VSDKPageView
VSDKProductClick
VSDKProductCustomization
VSDKProductFeedback
VSDKProductImpression
VSDKProductView
VSDKProductViewDetails
VSDKRemoveFromCart
VSDKSearch
#
Create your custom tracking eventIf none of the available tracking events matches your needs you can also extend VSDKTrackingEvent
and create your own.
Beware! Custom tracking events might not be interpreted by our services and will have limited functionality (logging and basic statistics). Please try to use one of the existing tracking events model classes or at least inherit from one of those classes when creating a custom event to ensure you make the most out of Velocidi's CDP.
#
Objective-CCreate a new Cocoa Touch class that inherits from VSDKTrackingEvent
(or any of the other tracking event model classes).
Example:
CustomEvent.h
CustomEvent.m
This new class can then be imported and used like any other tracking event:
#
SwiftDue to limitations of the framework we use to serialize classes to JSON (JSONModel), a Swift class that inherits from VSDKTrackingEvent
or any tracking event model class won't have its properties serialized when sending the event. To have this functionality you will have to create your custom event in Objective-C and import it into Swift:
- Create a new Cocoa Touch class.
- When prompted with the desired language, make sure to choose Objective-C. Press Next.
- After creating the class you'll be asked if you want to configure an Objective-C bridging header. Press Create Bridging Header.
- Three new files should have been created.
- Import the created custom event class in the bridging header file (AppName-Bridging-Header.h):
Add the desired fields to the custom event (see Objective-C instructions for custom events)
Use the newly created class as any other tracking event model class:
If you had any problem with importing the Objective-C class into Swift, please take a look at Apple's guide on Importing Objective-C into Swift.