Sometimes you want to have your own meta-data on different impressions. You might want to identify those impressions later (on SOOMLA data dumps) in order to correlate them with your data from other sources.
SOOMLA allows you to add your very own custom info for every captured impression.
In order to do it, you need to create a listener for impressions. SOOMLA will notify your listener when an ad is shown and will give you the opportunity to add your own key-value information on it.
Here is a simple example:
Android
SoomlaTraceback.getInstance().setAdsCustomData(new SoomlaAdsCustomData() {
@Override
public JSONObject getImpressionCustomData(String adNetwork, Advertising.AdType adType, JSONObject extra) {
JSONObject customData = new JSONObject();
//Add custom data here
return customData;
}
});
);
iOS
[SoomlaTraceback getInstance].adsCustomData = self;
@interface ViewController () <SoomlaAdsCustomData>
@end
- (NSDictionary*)impressionCustomDataForAdNetwork:(NSString*)adNetwork withAdType:(TracebackAdType)adType andExtra:(NSDictionary*)extra {
NSMutableDictionary *customData = [NSMutableDictionary dictionary];
//Add custom data here
return customData;
}
Unity3D
SoomlaConfig sc = new SoomlaConfig();
SoomlaTraceback.setAdsCustomData(new SoomlaAdsCustomData());
using UnityEngine;
using Soomla.Traceback;
public class SoomlaAdsCustomData : ISoomlaAdsCustomData
{
public JSONObject getImpressionCustomData(string adNetwork, int adType, JSONObject extra)
{
JSONObject jsonResponse = new JSONObject();
jsonResponse.AddField("key_1", "value_1");
jsonResponse.AddField("key_2", 1234);
jsonResponse.AddField("key_3_json", extra);
return jsonResponse;
}
}
Your custom impression level data will be added to every impression in the impres
sions data dumps. If you want to learn more about this dump please refer to the dashboard or ask your account manager.