A simple framework for firing MediaMath Pixels
The SDK has four static reporting functions:
-
report(advertiser: Int, pixel: Int, addlParams: String?)
-
report(advertiser: String, pixel: String, addlParams: String?)
-
report(advertiser: Int, pixel: Int, addlParams: [String: String])
-
report(advertiser: String, pixel: String, addlParams: [String: String])
advertiser
: TerminalOne Advertiser ID (value from&mt_adid=
of a JS pixel from a website)pixel
: TerminalOne Pixel ID (value from&mt_id=
of a JS pixel from a website)addlParams
: Additional information to send to TerminalOne at the time of pixel fire (see 'The addlParams argment')
addlParams
may be passed in as a [String: String]
dictionary or as a URL-encoded string of parameters joined by ampersand characters (e.g."v1=data1&v2=data2&s1=data3"
) It may be omitted from function calls if not needed. Advertisers typically use these in scenarios such as the following:
The addlParams
may be used in the following ways:
- Revenue tracking: To send a pixel tracking the value of an order, include something like
v1=99.99&s1=USD
. - Deterministic reinforcement: include a
mt_exem
ormt_excl
argument- The value for the mt_exem (for hashed emails, '[email protected]') or the mt_excl (for hashed account ids, e.g. 'john2015', '829852', etc) must be SHA-256 hashed at the time of pixel firing
- When using
addlParams: [String: String]
, the value ofmt_excl
is automatically hashed. The value ofmt_exem
is hashed if it contains an '@' character (i.e. if it is an email address) - When using
addlParams: String
, hashing is not performed by the MediaMath Pixel SDK. The app developer must SHA-256 hash the value. - For more information, see the API docs on mobile pixels.
- For more information on additional parameters, consule the Knowledge Base.
There is a setDebugOutput(debug: Bool)
function for enabling the printing of debug output to console.
Check out the MMPixelExampleApp
for a simple implementation of the framework.