AppsFlyerSDK / appsflyer-cordova-plugin

AppsFlyer plugin for Cordova
MIT License
37 stars 71 forks source link

AppsFlyerPlugin setAppInviteOneLinkID INVALID ["options": [XXXX]] #95

Closed seanwilson closed 4 years ago

seanwilson commented 4 years ago

Report

Plugin Version

5.2.2

On what Platform are you having the issue?

iOS

What did you do?

After successful initialisation, I'm attempting to set my onelink app id with

this.appsflyer.setAppInviteOneLinkID('XXXX');

(Obviously I'm not using XXXX, I'm using the corresponding OneLink template ID)

(this.appsflyer is declared at the beginning of my class)

I then want to create a short link with this.appsflyer.generateInviteLink(inviteOptions, this.onInviteLinkSuccess.bind(this), this.onInviteLinkError.bind(this));

In the onInviteLinkSuccess method, I'm console logging the result.

What did you expect to happen?

A onelink short link to be logged in the console

What happened instead?

I'm getting the following error in Xcode 11.5:

AppsFlyerPlugin setAppInviteOneLinkID INVALID ["options": [XXXX]]

(Obviously I'm not using XXXX, I'm using the corresponding OneLink template ID)

The success callback is called and I get this in the console:

https://go.onelink.me/XXXX?&c=myCampaign&myParam=newUser&af_referrer_uid=1591375487395-8544885&af_channel=gmail&anotherParam=fromWeb&af_siteid=1517060321&af_referrer_customer_id=1234&pid=af_app_invites

This is not the shortened User Invite link I was hoping for!

Please provide any other relevant information.

I got the OneLink template ID from the OneLink templates page in my Appsflyer account.

onInitSdkSuccess(msg) { console.log("onInitSdkSuccess: " + msg); try { console.log("about to setAppInviteOneLinkID"); this.appsflyer.setAppInviteOneLinkID('XXXX'); console.log("should have setAppInviteOneLinkID"); var inviteOptions = { channel: 'gmail', campaign: 'myCampaign', customerID: '1234', userParams: { myParam: 'newUser', anotherParam: 'fromWeb', amount: 1 } }; this.appsflyer.generateInviteLink(inviteOptions, this.onInviteLinkSuccess.bind(this), this.onInviteLinkError.bind(this)); } catch (error) { console.log("AppsFlyer error: "); console.log(error.name); console.log(error.message); console.log(error.stack); } }

onInitSdkError(err) {
  console.log("onInitSdkError: " + err);

}

onInviteLinkSuccess(link) { console.log("onInviteLinkSuccess: " + link); // Handle Generated Link Here }

onInviteLinkError(err) { console.log("onInviteLinkError: " + err); }

seanwilson commented 4 years ago

OK, this is now resolved thanks to excellent help from the AppsFlyer support team:

"To generate a shortened OneLink with the User Invite feature you must set a sub-domain for your OneLink in the OneLink templates page, If you do not set a unique sub-domain for your OneLink, a "long" OneLink will be generated with all the added parameters visible on the link."

After adding a subdomain to my OneLink template, I'm now getting a shortened url :)