Are you leveraging Adobe Analytics to track your mobile app? Wouldn’t it be cool if you could leverage your Analytics Tracking to potentially trigger an in-app message based off of a segment from Audience Manager at the same time? In this post, we’ll show you exactly how to do that.
Audience Manager returns segment and audience information via JSON response. This gives you the ability to fetch and parse the JSON response in the app. Please note that Target also returns information via JSON response. In the two main flavors to fetch the response in the app, you would need:
- iOS -> NSJSONSerialization
- Android -> JSONObject
You can now pass ID (segments) values as a comma delimited context data variable. An example of the code could look like this:
- let str = “{\”ice cream flavors\”: [\”strawberry\”, \”vanilla\”, \”chocolate\”, \”cookie dough\”, \”banana\”, \”mint chocolate\”]}”
- let data = str.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
do {
let json = try NSJSONSerialization.JSONObjectWithData(data, options: []) as!
[String: AnyObject]
if let ice_cream_list = json[“ice cream flavors”] as? [String] {
let stringRepresentation = ice_cream_list.joinWithSeparator(“,”)
cData[“omn.ice_cream_list”]=stringRepresentation
}
} catch let error as NSError {
ADBMobile.trackAction(error.localizedDescription, data: nil)
}
With this string of code, you can trigger in-app messages in real time based on the value. This can also be used to trigger a postback.
That’s it! With code in place, you can now use Audience Manager to trigger in-app messages.