Expand my Community achievements bar.

SOLVED

Get Recommendations with custom params in mobile

Avatar

Level 1

I am trying to integrate the recommendations in my mobile app for both Android and iOS. So far things that I have done are :-

1. created a recommendation in target, whose main purpose would be to give results based on the country.

bhavna18_0-1594788074960.png

This is what my criteria looks like : 

bhavna18_1-1594788133551.png 

and this is how I choose the key

bhavna18_2-1594788228766.png

And then in design, I am returning the json which looks something like this

bhavna18_3-1594788319722.png

Also I have uploaded a .csv file, which is used to feed the data.

bhavna18_4-1594788400925.png

 

And I am calling my recommendation as:

customParameters.put("enitity.id","mexico"); //hashmap has been created

TargetLocationRequest loadActivity = Target.createRequest("mobile_featured_destinations",null,customParameters);
Target.loadRequest(loadActivity, new Target.TargetCallback<String>() {

@Override
public void call(String callback) {
System.out.println("callback received from target: "+mboxName+ "is: "+callback);
}

Now the results that I am getting are same irrespective of whatever value I pass, as I am expecting that on passing "india", the recommendation order will change as mentioned in the feed, but it's not happening. Is there anything I am missing, or understanding and implementing it incorrectly. 

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @bhavna18 

How is the user.country being set? Is that a profile script that returns the visitor's county based on some geo lookup? If so, you don't need to pass an entity.id in the request to Target. The profile script will run and provide the "key" for the recommendations. You wouldn't be able to "spoof" other keys though unless you can get the profile script to return a different value.

However, if you are wanting to pass the country directly to Target as the key/id you can do that too. To make that work I'd keep the criteria key as current item and then pass the entity.id of the country in the request.

Hope that helps.

View solution in original post

8 Replies

Avatar

Correct answer by
Employee Advisor

Hi @bhavna18 

How is the user.country being set? Is that a profile script that returns the visitor's county based on some geo lookup? If so, you don't need to pass an entity.id in the request to Target. The profile script will run and provide the "key" for the recommendations. You wouldn't be able to "spoof" other keys though unless you can get the profile script to return a different value.

However, if you are wanting to pass the country directly to Target as the key/id you can do that too. To make that work I'd keep the criteria key as current item and then pass the entity.id of the country in the request.

Hope that helps.

Avatar

Level 1

Hi @Ryan_Roberts_,
Thanks for making this clear. I have a question , how user.country picks the country? 

Also, when I am trying by passing custom parameter, entity.id as mentioned in the above comment, and setting my criteria key/ recommendation key to current item keeping other things same,I am getting any results.  Is this the expected behavior, since I haven't made any changes in the criteria, so I need to do some other changes to validate it?

Avatar

Employee Advisor
Hi @bhavna18, user.country should be custom parameter to your account so I don't know how it is getting set. You've need to browse to Target > Audiences > Profile Scripts > country to find how it is being set.

Avatar

Employee Advisor
If you tweaked the criteria key to be current item and are passing the entity.id as a customer paramter with a value of mexico you should be getting results back as defined in your uploaded custom criteria. Though I do see an upload error on your criteria screen shot has that been fixed? Otherwise you might be getting backup recommendations.

Avatar

Level 1

Hi @Ryan_Roberts_,
user.country which is custom parameter to my account has been set as "profile.geolocation.country". But on what bases this profile changes the location? I mean is there any way I can get different results by changing the this value, if so how can I do it since I am not passing anything into profile.

bhavna18_0-1594953212484.png

 

Avatar

Level 1

Also, the error you pointed i fixed but still not getting any results. This is my new criteria 

bhavna18_0-1594953857693.png

bhavna18_1-1594953892292.png

The csv is same as I uploaded in my initial comment and my recommendation looks like this:-

bhavna18_2-1594954001742.png

But still  I was not getting any results, 

customParameters.put("enitity.id","mexico"); //hashmap has been created

TargetLocationRequest loadActivity = Target.createRequest("mobile_featured_destinations",null,customParameters);
Target.loadRequest(loadActivity, new Target.TargetCallback<String>() {

@Override
public void call(String callback) { //this returns null
System.out.println("callback received from target: "+mboxName+ "is: "+callback);
}

 

Avatar

Employee Advisor

Hi, the profile.geolocation.country is using the out of the box geolocation feature from Target. In a nutshell it's IP based lookup that happens at the beginning of each session. You can read details here: https://docs.adobe.com/content/help/en/target/using/audiences/create-audiences/categories-audiences/...

Please DM me about the other question with your account details. I can help look into that for you.