apptentive / apptentive-android

Apptentive Android SDK
http://www.apptentive.com
BSD 3-Clause "New" or "Revised" License
65 stars 64 forks source link

Survey does not show with SDK 5.7.1 #230

Open hydejiaqi opened 2 years ago

hydejiaqi commented 2 years ago

Hi, we want to upgrade the SDK to 5.7.1, but I find out the survey never shows with latest SDK, and once I switch back to SDK 5.6.4, the survey just works as expected.

I/Apptentive: Registering Apptentive Android SDK 5.7.1 I/Apptentive: [Apptentive Queue] [CONVERSATION] Loading 'anonymous' conversation... I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'com.apptentive#app#launch' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'local#app#saved_home' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Criteria evaluated => false I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'local#app#filter_changed' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Criteria evaluated => false I/Apptentive: Registering Apptentive Android SDK 5.6.4 I/Apptentive: [Apptentive Queue] [CONVERSATION] Loading 'anonymous' conversation... I/Apptentive: [Apptentive Queue] [CONVERSATION] SDK version was changed: 5.7.1 => 5.6.4 I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'com.apptentive#app#launch' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'local#app#filter_changed' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Criteria evaluated => true I/Apptentive: [INTERACTIONS] Launching interaction: 'Survey' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'com.apptentive#Survey#launch' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'com.apptentive#Survey#question_response' I/Apptentive: Survey Submitted. I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'com.apptentive#Survey#submit' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'local#app#saved_home' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Criteria evaluated => false

CaseyApptentive commented 2 years ago

Hi @hydejiaqi. Sorry that you're having trouble.

It looks like the criteria for the interactions aren't being met. That's what we're seeing in the logs after each "engage event" is being evaluated. Here's an example of the key section.

I/Apptentive: [Apptentive Queue] [INTERACTIONS] Engage event: 'local#app#saved_home' I/Apptentive: [Apptentive Queue] [INTERACTIONS] Criteria evaluated => false

You can see that the event is successfully engaged, and then the criteria is evaluated false, which just means that the targeting hasn't been fulfilled.

There are a few options for investigating and fixing this:

Thanks!

hydejiaqi commented 2 years ago

@CaseyApptentive, thanks for your quick reply.

I am using the same survey settings for both 5.7.1 and 5.6.4 SDK, but the criteria evaluated always returns false while using SDK 5.7.1. The only change I do is just change the SDK version to 5.7.1.

I pull the verbose logs, looks like the random survey id we set in the custom device data is always null in the log, and we use that value in the survey settings. In our code, we add this id after initial Apptentive by Apptentive.addCustomDeviceData( "ApptentiveRandomSurveyKey", deviceData )

But in the verbose log, the value is always null

D/Apptentive: [Apptentive Queue] [INTERACTIONS] Criteria evaluation details:

- $and:

  - $or:

    - person_data['ApptentiveRandomSurveyKey'] ('null') greater than '50' => false 

When I switch back to 5.6.4 SDK without any other changes in our code, the survey works as expected. Our survey id is not null in the log

D/Apptentive: [Apptentive Queue] [INTERACTIONS] Criteria evaluation details:

- $and:

  - $or:

    - person_data['ApptentiveRandomSurveyKey'] ('72') greater than '50' => true

  - current time ('1.637109009873E9') is greater than or equal to '1.6327872E9' => true

I wonder is there any changes related to custom device data in the latest SDK ? Thanks.

CaseyApptentive commented 2 years ago

Thanks for the thorough logs! Looking into this now.

It does look like the null with ApptentiveRandomSurveyKey is the problem, though it's hard to say why.

One question: are you planning on using this type of targeting in production? If so, can you help me understand what it does?

We can certainly try to straighten this out for you, but I am asking because it sounds like you might be randomly generating a number in order to make the survey show to 50% of your audience. Is that true?

I wonder because we have actually made a recent product release that does the same thing, and it would give you more flexibility.

Let me know what's the best approach.

hydejiaqi commented 2 years ago

Thanks for the thorough logs! Looking into this now.

It does look like the null with ApptentiveRandomSurveyKey is the problem, though it's hard to say why.

One question: are you planning on using this type of targeting in production? If so, can you help me understand what it does?

We can certainly try to straighten this out for you, but I am asking because it sounds like you might be randomly generating a number in order to make the survey show to 50% of your audience. Is that true?

I wonder because we have actually made a recent product release that does the same thing, and it would give you more flexibility.

Let me know what's the best approach.

Yeah, we are currently using this type of targeting in production. I will be glade to see if there is an alternative way to do so.

CaseyApptentive commented 2 years ago

No problem. This feature is available on iOS SDK version 5.3.4. and Android version 5.7.0. You can access this new feature in the "Who" targeting section for any interaction type.

On the dropdown, select "Random Sampling: Percent of Customers", like this

Screen Shot 2021-11-17 at 11 25 23 AM

Here are some docs to help you make the most of it:

https://learn.apptentive.com/knowledge-base/how-to-use-random-sampling/ https://learn.apptentive.com/knowledge-base/random-sampling-use-cases/

Will that work for you?

By the way, if you reach out to us at support@apptentive.com and let us know which app you're working on, I can connect you with someone from my team to help you use this feature. Just let us know.