A guide to integrate Pixalate's light-weight impression library for mobile SDK implementation in your iOS app. This library facilitates the construction and sending of impression URLs with the key values needed by Pixalate for IVT measurement.
For Pixalate clients and users, please login to access this page with additional information.
Accessing the Library
You can install the library using CocoaPods, or by cloning the repository directly.
Simply add the library as a dependency in your project's Podfile:
Then install it into the project using the pod update terminal command.
You can download the most recent framework from the releases page in the GitHub repository.
Importing the Library
Once you've added the library to your project, you can import it into your files:
A sample implementation utilizing the MoPub SDK is available via the project's GitHub repository, under the sample-app-swift folder.
Building the Sample Project
- Clone the repository to your computer.
- Open a Terminal window to the sample app's folder.
- Run pod install, and then open the generated sample-app-swift.xcworkspace.
Creation of immutable impression objects is done through the use of a builder helper class. To make a new impression, it is easiest to use the class method PXImpression.make(clientId:builder:). This method takes a closure in which you can define all of your relevant values at once.
If you don't want to use the closure method, you can also initialize the builder yourself and pass it to PXImpression directly.
For your convenience, parameter names are mapped as human-readable string constants. The available mappings are outlined below and please contact your Customer Success representative for sample code blocks and string values for the list below.
|Line item Id
|Video Play Status
The impression builder accepts any value as a parameter name. The mappings outlined above are merely provided as a convenience for commonly used parameters.
You must explicitly provide the impression builder with all parameters that you are able to include.
To send an impression, pass your built PXImpression instance to the Pixalate.sendImpression(_:) class method:
let impression = /* create an impression using your preferred method */;
Building and sending of impressions can be compacted into a one-line call, if you do not wish to pre-build impression data.
When to Send Impressions
In order to have the most accurate and MRC-compliant results from integration with Pixalate's impression library, it is important to place your impression snippet at the correct location within your ad code. For example, if you want to record impressions for a banner ad using MoPub's iOS SDK, they provide an MPAdViewDelegate protocol that you can set up on your MPAdView. In this instance, you'd probably want to send the impression when adViewDidLoadAd(_:adSize:) is called.
Please contact your Customer Success representative for sample code blocks.
It's important that the impression is sent as close to the actual impression event as possible. If you retrieve an ad, make sure that you only send an impression if you intend to show it.
- Enable support for builds that support x86, arm, or both
- Fix bugs related to the request of block status
- Add log level
- Add example Swift app
- Add example Objective-C app
- Switch impressions to use https
- Add block result caching
- Improve swift integration
- Initial release