Integrating with a Mobile App

Intilery have Mobile SDKs for Android, iOS and React-Native that can be used to simplify the development required to integrate Intilery into your mobile apps.

Each SDK give simple commands for the registration of users for push notifications, tracking push events and interacting with the Intilery APIs.

iOS

Get the iOS SDK.

Android

Current best practice is to use retrofit to integrate with our events API. (See Below)

React-Native

Get the React-Native SDK. (Deprecated)

Alternatively you can use our REST APIs to send and receive data from Intilery without using our SDK.

App Integration Overview

Initialisation

There are three key variables needed when integrating an app with the Intilery Marketing Cloud:

  1. INTILERY_APP: The App name within mobile-apps tab on the Intilery settings page. (https://www.intilery.com/app/#/settings/mobile-apps)
  2. INTILERY_TOKEN: The Authentication token generated for your App after certification upload, located under the App name.
  3. INTILERY_API: The relevant host for Intilery's API endpoint associated with your account. "intilery-analytics.com" for standard Intilery Marketing Cloud installations 

    Note: Enterprise installations will have custom analytics hosts.

Events

Events API

Events should be send via an HTTPS POST request to the "INTILERY_API" with "/api/event" path, content type of application/json and using the APP TOKEN in the Authentication header of the request with value:

 “Basic: <APP TOKEN>”

Event Structure

A key difference for mobile app events is the visit data must include a unique identifier string generated device side by the App via the Intilery SDK or otherwise.

{
	"Visit": { "visitorID": "a-unique-string-here" },
	“EventAction”: “<event action>", 
	“EventName” : “<event name>”, 
	"EventData": { “<entity>.<property>”:”<value>” },
	"Context":{ 
		“Host”:”<app name>”, 
		“Path”:”<path>" 
		}, 
	“UserAgent”:”<app name or user agent string for device webbrowser>“, 
	“Location”:{
		“Latitude”:<number for latitude>,
		”Longitude”:<number for longitude> 
	}
}

Note: HappenedAt will be generated by Intilery systems if not included. If included HappenedAt must be in UTC Z TS or in Epoch seconds.

Push Notifications

Registration for  Push Notifications

Before device can receive push notifications from the Intilery Marketing Cloud they must register with a "Set device Id" event:

{
	"Visit": {"visitorID": "a-unique-string-here"},
	“EventAction”: “Set Device Id", 
	“EventName” : “<Set Device Id>”, 
	"EventData": { 
		“Register App.Device Id”: "<Device Token>"
		“Register App.AppCode”: <APP NAME>
	},
	"Context":{ 
		“Host”:”<app name>”, 
		“Path”:”<path>" 
	}

Note: <Device Token> the unique device identifier string created by Apple or GCM

Note: “EventData.Register App.Device Type”: <APP NAME> is only required for Apps with both iOS and Android device and must have a value of "iOS" or "Android".

Standard Push

In addition to the content of the push message, all push notifications from Intilery include a reference number for tracking. 

JSON for iOS Push:
{
  "aps": {
    "alert":"{{text}}",
    "sound":"default"
  },
  "it": {
    "id":"*|push_reference|*"
  }
}


JSON for Android Push:
{
  "data": {
    "message":"{{text}}",
    "it": {
      "id":"*|push_reference|*"
    }
  }

Standard Push Tracking

All push tracking events must include the push reference number ( userInfo[it][id] ) from the corresponding Push event

A “_push view” is fired for when a notification arrives and the app is in the foreground

{
	"Visit": {"visitorID": "a-unique-string-here"},
	“EventAction”: “_push view", 
	"EventData": { 
		“_email.reference”: "<push_reference>"
	}
}

“_push open” is fired for when a notification arrives and the app is in the background

{
	"Visit": {"visitorID": "a-unique-string-here"},
	“EventAction”: “_push open", 
	"EventData": { 
		“_email.reference”: "<push_reference>"
	}
}


Still need help? Contact Us Contact Us