question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apple search Ads on Cordova 9

See original GitHub issue

The problem is that we don’t see any data on Apple search Ads dashboard.

node: v10.16.3 cordova: 9.0.0 xcode: 11.3.1

The plugin version is 4.1.3 but with the following changes in order to be able to build with CLI:

Removed from: src/ios/BranchNPM.h #define BRANCH_NPM true

And added at plugin.xml and from xcode after building the framework is there <framework src="iAd.framework" weak="true"/>

I tried both with and without use-frameworks="true" with no difference.

The Branch service initialisation: function init() { return $window.Branch.delayInitToCheckForSearchAds() .then($window.Branch.initSession).then(linkHandler); }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
echo-branchcommented, Jan 22, 2021

Within Xcode, you can locate an AppDelegate.m file. You can enable early lifecycle calls here.

In this example, I enable logging to confirm ASA is working, remove it for production as it is very verbose. I then enable search ads and the longer delay as Cordova has a long launch time.

#import "AppDelegate.h"
#import "MainViewController.h"
#import "Branch.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    [Branch.getInstance enableLogging];
    [Branch.getInstance delayInitToCheckForSearchAds];
    [Branch.getInstance useLongerWaitForAppleSearchAds];
    
    self.viewController = [[MainViewController alloc] init];
    return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

@end

You should see the Search Ad base 64 encoded in the install json. On test devices, Apple provides a test payload so you should always see this while debugging.

"search_ad_encoded" = "eyJWZXJzaW9uMy4xIjp7ImlhZC1wdXJjaGFzZS1kYXRlIjoiMjAyMS0wMS0yMlQxODozMDozNVoiLCJpYWQta2V5d29yZCI6IktleXdvcmQiLCJpYWQtYWRncm91cC1pZCI6IjEyMzQ1Njc4OTAiLCJpYWQtY3JlYXRpdmVzZXQtaWQiOiIxMjM0NTY3ODkwIiwiaWFkLWNyZWF0aXZlc2V0LW5hbWUiOiJDcmVhdGl2ZVNldE5hbWUiLCJpYWQtY2FtcGFpZ24taWQiOiIxMjM0NTY3ODkwIiwiaWFkLWxpbmVpdGVtLWlkIjoiMTIzNDU2Nzg5MCIsImlhZC1vcmctaWQiOiIxMjM0NTY3ODkwIiwiaWFkLWNvbnZlcnNpb24tZGF0ZSI6IjIwMjEtMDEtMjJUMTg6MzA6MzVaIiwiaWFkLWtleXdvcmQtaWQiOiIxMjMyMzIyMiIsImlhZC1jb252ZXJzaW9uLXR5cGUiOiJEb3dubG9hZCIsImlhZC1jb3VudHJ5LW9yLXJlZ2lvbiI6IlVTIiwiaWFkLW9yZy1uYW1lIjoiT3JnTmFtZSIsImlhZC1jYW1wYWlnbi1uYW1lIjoiQ2FtcGFpZ25OYW1lIiwiaWFkLWNsaWNrLWRhdGUiOiIyMDIxLTAxLTIyVDE4OjMwOjM1WiIsImlhZC1hdHRyaWJ1dGlvbiI6InRydWUiLCJpYWQtYWRncm91cC1uYW1lIjoiQWRHcm91cE5hbWUiLCJpYWQta2V5d29yZC1tYXRjaHR5cGUiOiJCcm9hZCIsImlhZC1saW5laXRlbS1uYW1lIjoiTGluZU5hbWUifX0=";

If you wish to ignore the Apple test payload call this method.

[Branch.getInstance ignoreAppleSearchAdsTestData];
0reactions
echo-branchcommented, Jan 24, 2021

This works by setting the Branch SDK to lookup Apple Search Ads before the install event. This will ensure we have it show up properly on the dashboard, we also return it in the callback to the JS code.

This is not possible from JS alone, cause the Cordova JS environment starts up after the initial install. Which means we probably sent the install without the ASA data payload.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apple Search Ads
Promote your app where it matters most. Apple Search Ads helps people discover your app on the App Store, matching customers with your...
Read more >
iOS Platform Guide - Apache Cordova
iOS Platform Guide. This guide shows how to set up your SDK development environment to deploy Cordova apps for iOS devices such as...
Read more >
Create an Apple Search Ads Campaign - Kochava Support
Click Add a Configuration. · Select Media Partner > Apple Search Ads. · Click Go. · Select Install > Postback Tools (⋮) >...
Read more >
cordova-admob-ads - npm
Easy to use and very complete admob ads plugin for cordova, phonegap, intel and ionic. ... Latest version: 2.0.9, last published: 4 years...
Read more >
Cordova PhoneGap Ionic - Branch Help
This change is backward-compatible with Cordova 8. Apple Search Ads: iOS. Follow the native iOS documentation for setting up Apple Search Ads.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found