Get Recommendations with custom params in mobile | Community
Skip to main content
July 15, 2020
Solved

Get Recommendations with custom params in mobile

  • July 15, 2020
  • 1 reply
  • 2192 views

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.

This is what my criteria looks like : 

 

and this is how I choose the key

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

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

 

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. 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ryanr7

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.

1 reply

ryanr7Adobe EmployeeAccepted solution
Adobe Employee
July 15, 2020

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.

bhavna18Author
July 16, 2020

Hi @ryanr7,
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?