This feature is available only with paid Kochava accounts. Contact us to learn more.
The marketer will also need to enter credentials for their monetization partner within the Partner Configuration dashboard. This allows Free App Analytics to connect with your monetization partner’s API and pull relevant revenue data which is then linked to the ad impressions served in your app.
Depending on your monetization partner, deeper integrations may be available, which support advanced capabilities (i.e. restated ad revenue). Please check with your Client Success Manager or contact support@kochava.com for details.
SDK Integrations
The SDK integration samples make use of the callback delegates provided by the specific Ad Network and include parameters that are readily available. Some implementations of an Ad Network may have additional data that is not listed by the integration document that could improve ad revenue accuracy. If you wish to send additional parameters beyond what is listed contact your Client Success Team.
Once you are aware an ad has been served (either from having initiated it, or having been notified that it was served), construct and send an Ad View type event as described in the samples below.
If a Mediation or Ad Network that Free App Analytics does not have an existing integration listed is desired to be utilized, please contact with your information Integrations@kochava.com.
AdColony:
The ad_network_name parameter must be provided with every event with the value of AdColony.
Interstitial —
@Override public void onOpened(AdColonyInterstitial ad) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AdColony") .setAdType("Interstitial") .setAdPlacement(ad.getZoneID()) ); }
Rewarded Video —
@Override public void onOpened(AdColonyInterstitial ad) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AdColony") .setAdType("Rewarded Video") .setAdPlacement(ad.getZoneID()) ); }
Native —
//If known set the ad size based on what was passed into the requestNativeAdView call. @Override public void onOpened(AdColonyInterstitial ad) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AdColony") .setAdType("Native") .setAdSize("MEDIUM_RECTANGLE") .setAdPlacement(ad.getZoneID()) ); }
Interstitial —
//Insert the following code in the success block of your call to requestInterstitialInZone:options:success:failure: // weakAd // Discussion: Capturing 'ad' strongly in the ad.open block would lead to a retain cycle. __weak AdColonyInterstitial *weakAd = ad; // ad.open ad.open = ^{ KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"AdColony"; kochavaEvent.adTypeString = @"Interstitial"; kochavaEvent.adPlacementString = weakAd.zoneID; [KochavaTracker.shared sendEvent:kochavaEvent]; } };
Rewarded Video —
//Insert the following code in the success block of your call to requestInterstitialInZone:options:success:failure: // weakAd // Discussion: Capturing 'ad' strongly in the ad.open block would lead to a retain cycle. __weak AdColonyInterstitial *weakAd = ad; // ad.open ad.open = ^{ // kochavaEvent KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"AdColony"; kochavaEvent.adTypeString = @"Rewarded Video"; kochavaEvent.adPlacementString = weakAd.zoneID; [KochavaTracker.shared sendEvent:kochavaEvent]; } };
Native —
//Insert the following code in the success block of your call to requestNativeAdViewInZone:size:options:success:failure: // weakAd // Discussion: Capturing 'ad' strongly in the ad.open block would lead to a retain cycle. __weak AdColonyNativeAdView *weakAd = ad; // ad.open ad.start = ^{ // kochavaEvent KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"AdColony"; kochavaEvent.adTypeString = @"Native"; kochavaEvent.adPlacementString = weakAd.zoneID; [KochavaTracker.shared sendEvent:kochavaEvent]; } };
AdMob:
The ad_network_name parameter must be provided with every event with the value of AdMob.
Banner —
// If known setAdSize with one of the following. “BANNER”, “LARGE_BANNER”, “MEDIUM_RECTANGLE”, “FULL_BANNER”, “LEADERBOARD”, “SMART_BANNER” @Override public void onAdLoaded() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AdMob") .setAdType("Banner") .setAdSize("SMART_BANNER") .setAdPlacement("_INSERT_YOUR_AD_UNIT_ID_") ); }
Interstitial —
@Override public void onAdOpened() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AdMob") .setAdType("Interstitial") .setAdPlacement("_INSERT_YOUR_AD_UNIT_ID_") ); }
Rewarded Video —
@Override public void onRewardedVideoStarted() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AdMob") .setAdType("rewarded") .setAdPlacement("_INSERT_YOUR_AD_UNIT_ID_") ); }
Native Express —
//If known from the request set the ad size to "Small", "Medium", or "Large" @Override public void onAdLoaded() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AdMob") .setAdType("Native") .setAdSize("Small") .setAdPlacement("_insert_ad_unit_id") ); }
Native Advanced —
@Override public void onAdLoaded() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AdMob") .setAdType("Native") .setAdPlacement("_insert_ad_unit_id") ); }
Banner —
func adViewDidReceiveAd(_ bannerView: GADBannerView) { if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "AdMob" kochavaEvent.adTypeString = "Banner" kochavaEvent.adSizeString = NSStringFromCGSize(CGSizeFromGADAdSize(bannerView.adSize)) kochavaEvent.adPlacementString = bannerView.adUnitID kochavaEvent.adMediationNameString = bannerView.adNetworkClassName KochavaTracker.shared.send(kochavaEvent) } }
Interstitial —
func interstitialDidDismissScreen(_ ad: GADInterstitial) { if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "AdMob" kochavaEvent.adTypeString = "Interstitial" kochavaEvent.adPlacementString = ad.adUnitID kochavaEvent.adMediationNameString = ad.adNetworkClassName KochavaTracker.shared.send(kochavaEvent) } }
Rewarded Video —
func rewardBasedVideoAdDidStartPlaying(_ rewardBasedVideoAd: GADRewardBasedVideoAd) { if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "AdMob" kochavaEvent.adTypeString = "Rewarded Video" kochavaEvent.adPlacementString = nil // Insert your ad unit id in place of nil kochavaEvent.adMediationNameString = rewardBasedVideoAd.adNetworkClassName KochavaTracker.shared.send(kochavaEvent) } }
Native Express —
func nativeExpressAdViewDidReceiveAd(_ nativeExpressAdView: GADNativeExpressAdView) { if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "AdMob" kochavaEvent.adTypeString = "Native" kochavaEvent.adSizeString = NSStringFromCGSize(CGSizeFromGADAdSize(nativeExpressAdView.adSize)) kochavaEvent.adPlacementString = nativeExpressAdView.adUnitID kochavaEvent.adMediationNameString = nativeExpressAdView.adNetworkClassName as String? KochavaTracker.shared.send(kochavaEvent) } }
Native Advanced —
//Install Ad func adLoader(_ adLoader: GADAdLoader, didReceive nativeAppInstallAd: GADNativeAppInstallAd) { // The code which displays the native ad ... if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "AdMob" kochavaEvent.adTypeString = "Native" kochavaEvent.adPlacementString = nil // Insert your ad unit id in place of nil kochavaEvent.adMediationNameString = nativeAppInstallAd.adNetworkClassName as String? KochavaTracker.shared.send(kochavaEvent) } } //Content Ad func adLoader(_ adLoader: GADAdLoader, didReceive nativeContentAd: GADNativeContentAd) { // The code which displays the native ad ... if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "AdMob" kochavaEvent.adTypeString = "Native" kochavaEvent.adPlacementString = nil // Insert your ad unit id in place of nil kochavaEvent.adMediationNameString = nativeContentAd.adNetworkClassName as String? KochavaTracker.shared.send(kochavaEvent) } }
Banner —
public void HandleOnAdLoaded(object sender, EventArgs args) { var adEvent = new Kochava.Event(Kochava.EventType.AdView); adEvent.adNetworkName = "AdMob"; adEvent.adType = "Banner"; adEvent.adSize = "SMART_BANNER"; // Pick proper type from “BANNER”, “LARGE_BANNER”, “MEDIUM_RECTANGLE”, “FULL_BANNER”, “LEADERBOARD”, “SMART_BANNER” adEvent.adPlacement = "_INSERT_YOUR_AD_UNIT_ID_"; Kochava.Tracker.SendEvent(adEvent); }
Interstitial —
public void HandleOnAdOpened(object sender, EventArgs args) { var adEvent = new Kochava.Event(Kochava.EventType.AdView); adEvent.adNetworkName = "AdMob"; adEvent.adType = "Interstitial"; adEvent.adPlacement = "_INSERT_YOUR_AD_UNIT_ID_"; Kochava.Tracker.SendEvent(adEvent); }
Rewarded Video —
public void HandleRewardedAdOpening(object sender, EventArgs args) { var adEvent = new Kochava.Event(Kochava.EventType.AdView); adEvent.adNetworkName = "AdMob"; adEvent.adType = "Rewarded Video"; adEvent.adPlacement = "_INSERT_YOUR_AD_UNIT_ID_"; Kochava.Tracker.SendEvent(adEvent); }
Native Express —
private void HandleUnifiedNativeAdLoaded(object sender, UnifiedNativeAdEventArgs args) { var adEvent = new Kochava.Event(Kochava.EventType.AdView); adEvent.adNetworkName = "AdMob"; adEvent.adType = "Native"; adEvent.adPlacement = "_INSERT_YOUR_AD_UNIT_ID_"; Kochava.Tracker.SendEvent(adEvent); }
Native Advanced —
private void HandleUnifiedNativeAdLoaded(object sender, UnifiedNativeAdEventArgs args) { var adEvent = new Kochava.Event(Kochava.EventType.AdView); adEvent.adNetworkName = "AdMob"; adEvent.adType = "Native"; adEvent.adPlacement = "_INSERT_YOUR_AD_UNIT_ID_"; Kochava.Tracker.SendEvent(adEvent); }
AppLovin:
The ad_network_name parameter must be provided with every event with the value of AppLovin.
Banner —
Both Banner and MRec formats are considered banner ads of different sizes. Ensure the size is set to the defined value for each variant.
@Override public void adDisplayed(final AppLovinAd ad) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AppLovin") .setAdSize("320x50") .setAdType("Banner") ); }
MRec —
Both Banner and MRec formats are considered banner ads of different sizes. Ensure the size is set to the defined value for each variant.
@Override public void adDisplayed(final AppLovinAd ad) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AppLovin") .setAdSize("300x250") .setAdType("Banner") ); }
Interstitial —
@Override public void adDisplayed(AppLovinAd appLovinAd) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AppLovin") .setAdType("Interstitial") .setAdPlacement("_INSERT_YOUR_PLACEMENT_") ); }
Rewarded Video —
@Override public void adDisplayed(AppLovinAd appLovinAd) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AppLovin") .setAdType("Rewarded Video") .setAdPlacement("_INSERT_YOUR_PLACEMENT_") ); }
Native —
//When sending the impression url to the AppLovin PostbackService also call Kochava. Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("AppLovin") .setAdType("Native") );
Banner —
Both Banner and MRec formats are considered banner ads of different sizes. Ensure the size is set to the defined value for each variant.
NOTE: AppLovin has deprecated Banners and MRecs, indicating in code-level warnings that they will be removed in a future version of the SDK.
MRec —
Both Banner and MRec formats are considered banner ads of different sizes. Ensure the size is set to the defined value for each variant.
NOTE: AppLovin has deprecated Banners and MRecs, indicating in code-level warnings that they will be removed in a future version of the SDK.
Interstitial —
- (void)ad:(nonnull ALAd *)ad wasDisplayedIn:(nonnull UIView *)view { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"AppLovin"; kochavaEvent.adTypeString = @"Interstitial"; kochavaEvent.adSizeString = ad.size.label; kochavaEvent.adPlacementString = nil; // Insert your placement in place of nil kochavaEvent.contentIdString = [NSString stringWithFormat:@"%@", ad.adIdNumber]; [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Rewarded Video —
- (void)ad:(nonnull ALAd *)ad wasDisplayedIn:(nonnull UIView *)view { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"AppLovin"; kochavaEvent.adTypeString = @"Rewarded Video"; kochavaEvent.adSizeString = ad.size.label; kochavaEvent.adPlacementString = nil; // Insert your placement in place of nil kochavaEvent.contentIdString = [NSString stringWithFormat:@"%@", ad.adIdNumber]; [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Native —
//Call this when you show a native ad. KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"AppLovin"; kochavaEvent.adTypeString = @"Native"; kochavaEvent.adPlacementString = nil; // Insert your placement in place of nil kochavaEvent.contentIdString = [NSString stringWithFormat:@"%@", self.nativeAd.adIdNumber]; [KochavaTracker.shared sendEvent:kochavaEvent]; }
Appodeal:
The ad_network_name parameter must be provided with every event with the value of Appodeal.
Ad Placements can optionally be passed when showing an ad and will increase the accuracy of impression tracking. If you are passing in a placement when showing an ad also include it with the Free App Analytics Event.
Banner —
@Override public void onBannerShown() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Appodeal") .setAdType("Banner") .setAdPlacement("Ad Placement if known. Otherwise omit") ); }
Banner (MREC) —
MRec is a specific size of banner ad. Specify the size when using an MRec style ad to distinguish it from other banner ads.
@Override public void onMrecShown() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Appodeal") .setAdType("Banner") .setAdSize("300x250") .setAdPlacement("Ad Placement if known. Otherwise omit") ); }
Native Ad —
@Override public void onNativeShown(NativeAd nativeAd) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Appodeal") .setAdType("Native") .setAdMediationName(nativeAd.getAdProvider()) .setAdPlacement("Ad Placement if known. Otherwise omit") ); }
Interstitial —
This includes all formats of Interstitial ads including static, rich, and video.
@Override public void onInterstitialShown() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Appodeal") .setAdType("Interstitial") .setAdPlacement("Ad Placement if known. Otherwise omit") ); }
Rewarded Video —
This also includes NON_SKIPPABLE_VIDEO as Appodeal defines it as an alias of the Rewarded Video format.
@Override public void onRewardedVideoShown() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Appodeal") .setAdType("Rewarded Video") .setAdPlacement("Ad Placement if known. Otherwise omit") ); }
Banner —
func bannerDidShow() { if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "Appodeal" kochavaEvent.adTypeString = "Banner" kochavaEvent.adPlacementString = nil; // Insert your placement in place of nil if known KochavaTracker.shared.send(kochavaEvent) } }
Banner (MREC) —
MRec is a specific size of banner ad. Specify the size when using an MRec style ad to distinguish it from other banner ads.
func bannerViewDidShow(_ bannerView: APDBannerView!) { if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "Appodeal" kochavaEvent.adTypeString = "Banner" kochavaEvent.adPlacementString = bannerView.placement kochavaEvent.adSizeString = NSStringFromCGSize(bannerView.adSize) KochavaTracker.shared.send(kochavaEvent) } }
Native Ad —
func nativeAdWillLogImpression(_ nativeAd: APDNativeAd!) { if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "Appodeal" kochavaEvent.adTypeString = "Native" KochavaTracker.shared.send(kochavaEvent) } }
Interstitial —
This includes all formats of Interstitial ads including static, rich, and video.
func interstitialDidDismiss() { if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "Appodeal" kochavaEvent.adTypeString = "Interstitial" kochavaEvent.adPlacementString = nil; // Insert your placement in place of nil if known KochavaTracker.shared.send(kochavaEvent) } }
Rewarded Video —
This also includes NON_SKIPPABLE_VIDEO as Appodeal defines it as an alias of the Rewarded Video format.
func rewardedVideoDidFinish(_ rewardAmount: UInt, name rewardName: String!) { if let kochavaEvent = KochavaEvent(eventTypeEnum: .adView) { kochavaEvent.adNetworkNameString = "Appodeal" kochavaEvent.adTypeString = "Rewarded Video" kochavaEvent.adPlacementString = nil // Insert your ad unit id in place of nil KochavaTracker.shared.send(kochavaEvent) } }
Chartboost:
The ad_network_name parameter must be provided with every event with the value of Chartboost.
Interstitial and Video Interstitial —
Chartboost does not break out video interstitial from a static interstitial with its callbacks. Both are sent under the same type. If you know for sure that an ad is a video interstitial you may send the type as “Video Interstitial” to improve calculation accuracy.
@Override public void didDisplayInterstitial(String location) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Chartboost") .setAdType("Interstitial") .setAdPlacement(location) ); }
Rewarded Video —
@Override public void didDisplayRewardedVideo(String location) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Chartboost") .setAdType("Rewarded Video") .setAdPlacement(location) ); }
In Play —
In Play ads are managed by you. It is your responsibility to send this event after calling show on the inPlay ad.
//After calling inPlay.show(); Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Chartboost") .setAdType("Native") .setAdPlacement(location) );
Interstitial and Video Interstitial —
Chartboost does not break out video interstitial from a static interstitial with its callbacks. Both are sent under the same type. If you know for sure that an ad is a video interstitial you may send the type as Video Interstitial to improve calculation accuracy.
- (void)didDisplayInterstitial:(CBLocation)location { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"Chartboost"; kochavaEvent.adTypeString = @"Interstitial"; kochavaEvent.adPlacementString = location; [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Rewarded Video —
- (void)didDisplayRewardedVideo:(CBLocation)location { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"Chartboost"; kochavaEvent.adTypeString = @"Rewarded Video"; kochavaEvent.adPlacementString = location; [KochavaTracker.shared sendEvent:kochavaEvent]; } }
In Play —
In Play ads are managed by you. It is your responsibility to send this event after calling show on the inPlay ad.
//After calling [self.inPlay show] KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"Chartboost"; kochavaEvent.adTypeString = @"Native"; kochavaEvent.adPlacementString = inPlay.location; [KochavaTracker.shared sendEvent:kochavaEvent]; }
Facebook Audience Network
The ad_network_name parameter must be provided with every event with the value of FacebookAN.
Banner —
//If known from the setup call set the ad size to BANNER_HEIGHT_50, BANNER_HEIGHT_90, RECTANGLE_HEIGHT_250 @Override public void onLoggingImpression(Ad ad) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("FacebookAN") .setAdType("Banner") .setAdSize("SET_BANNER_SIZE") .setAdPlacement(ad.getPlacementId()) ); }
Interstitial —
@Override public void onLoggingImpression(Ad ad) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("FacebookAN") .setAdType("Interstitial") .setAdPlacement(ad.getPlacementId()) ); }
Native —
@Override public void onLoggingImpression(Ad ad) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("FacebookAN") .setAdType("Native") .setAdPlacement(ad.getPlacementId()) ); }
Rewarded Video —
@Override public void onAdLoaded(Ad ad) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("FacebookAN") .setAdType("Rewarded Video") .setAdPlacement(ad.getPlacementId()) ); }
Instream —
//When adview.show() is called also call the Kochava event. @Override public void onAdLoaded(Ad ad) { adContainer.addView(adView); adView.show(); Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("FacebookAN") .setAdType("Native") .setAdSize("Instream") .setAdPlacement(ad.getPlacementId()) ); }
Banner —
- (void)adViewDidLoad:(FBAdView *)adView { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"FacebookAN"; kochavaEvent.adTypeString = @"Banner"; kochavaEvent.adPlacementString = adView.placementID; [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Interstitial —
//Insert the following code after calling showAdFromRootViewController on your instance of FBInterstitialAd. This code assumes your instance of FBInterstitialAd is located at self.interstitialAd. KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"FacebookAN"; kochavaEvent.adTypeString = @"Interstitial"; kochavaEvent.adPlacementString = self.interstitialAd.placementID; [KochavaTracker.shared sendEvent:kochavaEvent]; }
Native —
- (void)adViewDidLoad:(FBAdView *)adView { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"FacebookAN"; kochavaEvent.adTypeString = @"Native"; kochavaEvent.adPlacementString = adView.placementID; [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Rewarded Video —
- (void)rewardedVideoAdWillLogImpression:(FBRewardedVideoAd *)rewardedVideoAd { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"FacebookAN"; kochavaEvent.adTypeString = @"Rewarded Video"; kochavaEvent.adPlacementString = rewardedVideoAd.placementID; [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Instream —
- (void)adViewDidLoad:(FBInstreamAdView *)adView { NSLog(@"Ad is loaded and ready to be displayed"); // The ad can now be added to the layout and shown self.adView.frame = self.view.bounds; self.adView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.view addSubview:self.adView]; [self.adView showAdFromRootViewController:self]; KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"FacebookAN"; kochavaEvent.adTypeString = @"Native"; kochavaEvent.adSizeString = @"Instream"; kochavaEvent.adPlacementString = adView.placementID; [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Fyber
The ad_network_name parameter must be provided with every event with the value of Fyber.
Banner —
@Override public void onAdLoaded(BannerAd ad) { Tracker.sendEvent(new Tracker.Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Fyber") .setAdType("Banner") .setAdPlacement(ad.getPlacementId()) ); }
Interstitial —
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == INTERSTITIAL_REQUEST_CODE) { InterstitialAdCloseReason adStatus = (InterstitialAdCloseReason) data.getSerializableExtra(InterstitialActivity.AD_STATUS); if(!adStatus.equals(InterstitialAdCloseReason.ReasonError)) { Tracker.sendEvent(new Tracker.Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Fyber") .setAdType("Interstitial") ); } } }
Reward Video —
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == REWARDED_VIDEO_REQUEST_CODE) { Tracker.sendEvent(new Tracker.Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Fyber") .setAdType("Rewarded Video") ); } }
Offerwall —
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == OFFER_WALL_REQUEST_CODE) { Tracker.sendEvent(new Tracker.Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Fyber") .setAdType("Offerwall") ); } }
Banner —
- (void)bannerControllerDidReceiveBanner:(FYBBannerController *)bannerController { KochavaEvent *event = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; event.adNetworkNameString = @"Fyber"; event.adTypeString = @"Banner"; event.adSizeString = NSStringFromCGSize(bannerController.bannerView.frame.size); event.adPlacementString = nil; // you can set it if you know it. [KochavaTracker.shared sendEvent:event]; }
Interstitial —
- (void)interstitialControllerDidPresentInterstitial:(FYBInterstitialController *)interstitialController { // You could alternately send the event in interstitialController:didDismissInterstitialWithReason: conditionally depending on the reason passed to it, but you'd need to make sure it works. In our testing parameter reason was always FYBInterstitialControllerDismissReasonAborted, no matter what happened. Also, interacting with the ad did not always generate a callback to that method. KochavaEvent *event = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; event.adNetworkNameString = @"Fyber"; event.adTypeString = @"Interstitial"; event.adPlacementString = nil; // you can set it if you know it. [KochavaTracker.shared sendEvent:event]; }
Reward Video —
- (void)rewardedVideoController:(FYBRewardedVideoController *)rewardedVideoController didDismissVideoWithReason:(FYBRewardedVideoControllerDismissReason)reason { if (reason == FYBRewardedVideoControllerDismissReasonUserEngaged) { KochavaEvent *event = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; event.adNetworkNameString = @"Fyber"; event.adTypeString = @"Rewarded Video"; event.adPlacementString = nil; // you can set it if you know it. [KochavaTracker.shared sendEvent:event]; } }
Offerwall —
// Insert this code when you present an offer wall. KochavaEvent *event = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; event.adNetworkNameString = @"Fyber"; event.adTypeString = @"Offerwall"; [KochavaTracker.shared sendEvent:event];
ironSource:
The ad_network_name parameter must be provided with every event with the value of ironSource.
Banner —
//Set ad size to "BANNER", "LARGE", or "RECTANGLE" @Override public void onBannerAdLoaded() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("ironSource") .setAdType("Banner") .setAdSize("Small") .setAdPlacement("_INSERT_YOUR_PLACEMENT_") ); }
Interstitial —
@Override public void onInterstitialAdShowSucceeded() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("ironSource") .setAdType("Interstitial") .setAdPlacement("_INSERT_YOUR_PLACEMENT_") ); }
Rewarded Video —
@Override public void onRewardedVideoAdStarted() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("ironSource") .setAdType("Rewarded Video") .setAdPlacement("_INSERT_YOUR_PLACEMENT_") ); }
Offerwall —
@Override public void onOfferwallOpened() { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("ironSource") .setAdType("Offerwall") .setAdPlacement("_INSERT_YOUR_PLACEMENT_") ); }
Banner —
- (void)bannerDidLoad:(UIView *)bannerView { NSLog(@"ISBannerDelegate bannerDidLoad"); // kochavaEvent KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"ironSource"; kochavaEvent.adTypeString = @"banner"; kochavaEvent.adSizeString = NSStringFromCGSize(bannerView.frame.size); kochavaEvent.adPlacementString = nil; // Insert your placement in place of nil [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Interstitial —
- (void)interstitialDidShow { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"ironSource"; kochavaEvent.adTypeString = @"Interstitial"; kochavaEvent.adPlacementString = nil; // Insert your placement in place of nil [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Rewarded Video —
- (void)rewardedVideoDidStart { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"ironSource"; kochavaEvent.adTypeString = @"Rewarded Video"; kochavaEvent.adPlacementString = nil; // Insert your placement in place of nil [KochavaTracker.shared sendEvent:kochavaEvent]; } }
Offerwall —
- (void)offerwallDidShow { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"ironSource"; kochavaEvent.adTypeString = @"Offerwall"; kochavaEvent.adPlacementString = nil; // Insert your placement in place of nil [KochavaTracker.shared sendEvent:kochavaEvent]; } }
MoPub:
MoPub provides publishers with revenue information associated with each impression, as well as information about which demand source served the ad. Publishers have full flexibility to expand event data with their own data and pass it to Free App Analytics.
The ad_network_name parameter must be provided with every event with the value of MoPub.
Direct JSON Version —
@Override public void onImpression(String adUnitId, @Nullable ImpressionData impressionData) { Tracker.Event event = new Tracker.Event(Tracker.EVENT_TYPE_AD_VIEW); if(impressionData != null) { event.addCustom(impressionData.getJsonRepresentation()); } else { event.setAdNetworkName("MoPub"); event.setAdPlacement(adUnitId); } Tracker.sendEvent(event); }
Manually Build Event —
@Override public void onImpression(String adUnitId, @Nullable ImpressionData impressionData) { Tracker.Event event = new Tracker.Event(Tracker.EVENT_TYPE_AD_VIEW); if(impressionData != null) { event.addCustom("adunit_id", impressionData.getAdUnitId()); event.addCustom("adunit_name", impressionData.getAdUnitName()); event.addCustom("adunit_format", impressionData.getAdUnitFormat()); event.addCustom("impression_id", impressionData.getImpressionId()); event.addCustom("currency", impressionData.getCurrency()); event.addCustom("publisher_revenue", impressionData.getPublisherRevenue()); event.addCustom("adgroup_id", impressionData.getAdGroupId()); event.addCustom("adgroup_name", impressionData.getAdGroupName()); event.addCustom("adgroup_type", impressionData.getAdGroupType()); event.addCustom("adgroup_priority", impressionData.getAdGroupPriority()); event.addCustom("country", impressionData.getCountry()); event.addCustom("precision", impressionData.getPrecision()); event.addCustom("network_name", impressionData.getNetworkName()); event.addCustom("network_placement_id", impressionData.getNetworkPlacementId()); } else { event.setAdNetworkName("MoPub"); event.setAdPlacement(adUnitId); } Tracker.sendEvent(event); }
Direct JSON Standard Impression —
- (void)mopubAd:(id
)ad didTrackImpressionWithImpressionData:(MPImpressionData * _Nullable)impressionData { // VALIDATE ELSE RETURN // impressionData if (impressionData == nil) { return; } // impressionObject NSError *jsonSerializationError = nil; NSObject *impressionObject = [NSJSONSerialization JSONObjectWithData:impressionData.jsonRepresentation options:0 error:&jsonSerializationError]; // impressionDictionary NSDictionary *impressionDictionary = [impressionObject isKindOfClass:NSDictionary.class] ? (NSDictionary *)impressionObject : nil; if (impressionDictionary == nil) { return; } // MAIN // KochavaTracker [KochavaTracker.shared sendEventWithNameString:@"Ad View" infoDictionary:impressionDictionary]; } Direct JSON Rewarded Video —
- (void)didTrackImpressionWithAdUnitID:(NSString *)adUnitID impressionData:(MPImpressionData * _Nullable)impressionData { // VALIDATE ELSE RETURN // impressionData if (impressionData == nil) { return; } // impressionObject NSError *jsonSerializationError = nil; NSObject *impressionObject = [NSJSONSerialization JSONObjectWithData:impressionData.jsonRepresentation options:0 error:&jsonSerializationError]; // impressionDictionary NSDictionary *impressionDictionary = [impressionObject isKindOfClass:NSDictionary.class] ? (NSDictionary *)impressionObject : nil; if (impressionDictionary == nil) { return; } // MAIN // KochavaTracker [KochavaTracker.shared sendEventWithNameString:@"Ad View" infoDictionary:impressionDictionary]; }
Manually Built Standard Impression —
- (void)mopubAd:(id
)ad didTrackImpressionWithImpressionData:(MPImpressionData * _Nullable)impressionData { // VALIDATE ELSE RETURN // impressionData if (impressionData == nil) { return; } // MAIN // precisionString NSString *precisionString = nil; switch (impressionData.precision) { case MPImpressionDataPrecisionExact: precisionString = @"exact"; break; case MPImpressionDataPrecisionEstimated: precisionString = @"estimated"; break; case MPImpressionDataPrecisionPublisherDefined: precisionString = @"publisher_defined"; break; case MPImpressionDataPrecisionUnknown: default: precisionString = nil; } // infoDictionary NSMutableDictionary *infoDictionary = NSMutableDictionary.dictionary; infoDictionary[@"adunit_id"] = impressionData.adUnitID; infoDictionary[@"adunit_name"] = impressionData.adUnitName; infoDictionary[@"adunit_format"] = impressionData.adUnitFormat; infoDictionary[@"impression_id"] = impressionData.impressionID; infoDictionary[@"currency"] = impressionData.currency; infoDictionary[@"publisher_revenue"] = impressionData.publisherRevenue; infoDictionary[@"adgroup_id"] = impressionData.adGroupID; infoDictionary[@"adgroup_name"] = impressionData.adGroupName; infoDictionary[@"adgroup_type"] = impressionData.adGroupType; infoDictionary[@"adgroup_priority"] = impressionData.adGroupPriority; infoDictionary[@"country"] = impressionData.country; infoDictionary[@"precision"] = precisionString; infoDictionary[@"network_name"] = impressionData.networkName; infoDictionary[@"network_placement_id"] = impressionData.networkPlacementID; // KochavaTracker [KochavaTracker.shared sendEventWithNameString:@"Ad View" infoDictionary:infoDictionary]; } Manually Built Rewarded Video —
- (void)didTrackImpressionWithAdUnitID:(NSString *)adUnitID impressionData:(MPImpressionData * _Nullable)impressionData { // VALIDATE ELSE RETURN // impressionData if (impressionData == nil) { return; } // MAIN // precisionString NSString *precisionString = nil; switch (impressionData.precision) { case MPImpressionDataPrecisionExact: precisionString = @"exact"; break; case MPImpressionDataPrecisionEstimated: precisionString = @"estimated"; break; case MPImpressionDataPrecisionPublisherDefined: precisionString = @"publisher_defined"; break; case MPImpressionDataPrecisionUnknown: default: precisionString = nil; } // infoDictionary NSMutableDictionary *infoDictionary = NSMutableDictionary.dictionary; infoDictionary[@"adunit_id"] = impressionData.adUnitID; infoDictionary[@"adunit_name"] = impressionData.adUnitName; infoDictionary[@"adunit_format"] = impressionData.adUnitFormat; infoDictionary[@"impression_id"] = impressionData.impressionID; infoDictionary[@"currency"] = impressionData.currency; infoDictionary[@"publisher_revenue"] = impressionData.publisherRevenue; infoDictionary[@"adgroup_id"] = impressionData.adGroupID; infoDictionary[@"adgroup_name"] = impressionData.adGroupName; infoDictionary[@"adgroup_type"] = impressionData.adGroupType; infoDictionary[@"adgroup_priority"] = impressionData.adGroupPriority; infoDictionary[@"country"] = impressionData.country; infoDictionary[@"precision"] = precisionString; infoDictionary[@"network_name"] = impressionData.networkName; infoDictionary[@"network_placement_id"] = impressionData.networkPlacementID; // KochavaTracker [KochavaTracker.shared sendEventWithNameString:@"Ad View" infoDictionary:infoDictionary]; }
Direct JSON Version —
void OnImpression(string adUnitId, MoPub.ImpressionData impressionData) { if (impressionData != null) { Kochava.Tracker.SendEvent ("Ad View", impressionData.JsonRepresentation); } else { Kochava.Event adEvent = new Kochava.Event (Kochava.EventType.AdView); adEvent.adPlacement = adUnitId; adEvent.adNetworkName = "MoPub"; Kochava.Tracker.SendEvent (adEvent); } }
Manually Build Event —
void OnImpression(string adUnitId, MoPub.ImpressionData impressionData) { Kochava.Event adEvent = new Kochava.Event (Kochava.EventType.AdView); if (impressionData != null) { adEvent.SetCustomValue ("adunit_id", impressionData.AdUnitId); adEvent.SetCustomValue ("adunit_name", impressionData.AdUnitName); adEvent.SetCustomValue ("adunit_format", impressionData.AdUnitFormat); adEvent.SetCustomValue ("impression_id", impressionData.ImpressionId); adEvent.SetCustomValue ("currency", impressionData.Currency); adEvent.SetCustomValue ("publisher_revenue", impressionData.PublisherRevenue); adEvent.SetCustomValue ("adgroup_id", impressionData.AdGroupId); adEvent.SetCustomValue ("adgroup_name", impressionData.AdGroupName); adEvent.SetCustomValue ("adgroup_type", impressionData.AdGroupType); adEvent.SetCustomValue ("adgroup_priority", impressionData.AdGroupPriority); adEvent.SetCustomValue ("country", impressionData.Country); adEvent.SetCustomValue ("precision", impressionData.Precision); adEvent.SetCustomValue ("network_name", impressionData.NetworkName); adEvent.SetCustomValue ("network_placement_id", impressionData.NetworkPlacementId); } else { adEvent.adNetworkName = "MoPub"; adEvent.adPlacement = adUnitId; } Kochava.Tracker.SendEvent (adEvent); }
Tapjoy:
The ad_network_name parameter must be provided with every event with the value of Tapjoy.
Interstitial, Rewarded Video, and Offerwall —
All ad types occur with a single delegate callback. It is up to you to keep track of what type of ad is being shown and to set the type correctly. Supported ad types are Interstitial, Rewarded Video, and Offerwall.
@Override public void onContentShow(TJPlacement tjPlacement) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("Tapjoy") .setAdType(“SET_AD_TYPE") .setAdPlacement(tjPlacement.getName()) ); }
Interstitial, Rewarded Video, and Offerwall —
All ad types occur with a single delegate callback. It is up to you to keep track of what type of ad is being shown and to set the type correctly. Supported ad types are Interstitial, Rewarded Video, and Offerwall.
- (void)contentDidAppear:(TJPlacement*)placement { KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"Tapjoy"; kochavaEvent.adTypeString = @"SET_AD_TYPE"; kochavaEvent.adPlacementString = placement.placementName; kochavaEvent.adMediationNameString = placement.mediationAgent; [KochavaTracker.shared sendEvent:kochavaEvent]; } }
UnityAds Ad:
The ad_network_name parameter must be provided with every event with the value of UnityAds.
Interstitial and Rewarded Video —
Both types of ads use the same callback. You must keep track of what ad was called to be shown to ensure the correct type is sent to Free App Analytics.
@Override public void onUnityAdsStart(String placement) { //Keep track of the last requested ad (interstitial or rewarded) if(rewarded) { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("UnityAds") .setAdType("Rewarded Video") .setAdPlacement(placement) ); } else { Tracker.sendEvent(new Event(Tracker.EVENT_TYPE_AD_VIEW) .setAdNetworkName("UnityAds") .setAdType("Interstitial") .setAdPlacement(placement) ); } }
Interstitial and Rewarded Video —
Both types of ads use the same callback. You must keep track of what ad was called to be shown to ensure the correct type is sent to Free App Analytics.
// rewardedVideoBool BOOL rewardedVideoBool = NO; // You are to keep track of which type will be loading next, and set this boolean accordingly. // adTypeString NSString *adTypeString = rewardedVideoBool ? @"Rewarded Video" : @"Interstitial"; // kochavaEvent KochavaEvent *kochavaEvent = [KochavaEvent eventWithEventTypeEnum:KochavaEventTypeEnumAdView]; if (kochavaEvent != nil) { kochavaEvent.adNetworkNameString = @"UnityAds"; kochavaEvent.adTypeString = adTypeString; kochavaEvent.adPlacementString = placementId; kochavaEvent.resultsString = (state == kUnityAdsFinishStateSkipped) ? @"skipped" : @"not skipped"; [KochavaTracker.shared sendEvent:kochavaEvent]; }
S2S Integrations
The S2S Integration provides an example with all possible values for ad_network_name with additional information to assist customers with the values that should be sent to Free App Analytics.
Network Names:
ad_network_name possible values are case insensitive (SELECT ltv_network_name FROM kochava.cpi_networks WHERE ltv_network_name != “”;)
- AdMob
- Appodeal
- Chartboost
- Fyber
- InMobi
- ironSource
- MoPub
Event Data:
The below table provides the mapping of Event data to the corresponding columns in the Query Table.
Event Data | Query Table Columns |
---|---|
device_type | device_type |
placement | placement |
ad_type | type |
ad_campaign_id | network_campaign_id |
ad_campaign_name | network_campaign_name |
ad_size | ad_size |
ad_group_name | group_name |
ad_group_id | group_id |
country_code | country_code |
S2S Event Example:
{ "data": { "usertime": 1521574016, "app_version": "1.0.0", "device_ver": "", "device_ids": { "idfa": "{idfa}" }, "device_ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3", "event_name": "ad view", "origination_ip": "104.219.46.66", "event_data": { "ad_network_name": "AdMob", "device_type": "<DEVICE_TYPE_HERE>", "placement": "<PLACEMENT_HERE>", "ad_type": "<AD_TYPE_HERE>", "ad_campaign_id": "<AD_CAMPAIGN_ID_HERE>", "ad_campaign_name": "<AD_CAMPAIGN_NAME_HERE>", "ad_size": "<AD_SIZE_HERE>", "ad_group_name": "<AD_GROUP_NAME_HERE>", "ad_group_id": "<AD_GROUP_ID_HERE>", "country_code": "<COUNTRY_CODE_HERE>" } }, "action": "event", "kochava_app_id": "<APP GUID HERE>", "kochava_device_id": "<CUSTOM VALUE>" }