Set Context with GEO API


(Tbaatar) #1

Hi,

I’m trying to create context detection with external GEO API using Matrix Rest asset (and without). The idea is to consume the geo api and print the json value (region) and use keyword to call it inside context configuration.

I’ve tried all the context config options But can’t get it to work at all.

Is this even possible?
How do you guys go about auto detection users region to serve different context without using any client side solution? or reload/secondary hit to the server?


(Tbaatar) #2

Made some progress but still can’t get it to work. But here are 2 ways I’m hoping to get it working.

Global Variable.
I was thinking wether it was possible to expose the Rest/JSON data into Context Configuration via Global Get variable. However the Rest or SSJS does’t really work globally?

How would you go about exposing it to the Context configuration?


Cookie

The other option I have almost working is via setting on Cookie.
Basically I have Trigger Action that sets the cookie value based on Rest Api response. In Context Configuration screen Cookie = GB.

It works only on the 2nd load.

Is it possible to get this to load at first load instead withour refresh?


(Tbaatar) #3

I think I got this working via the Persona asset with Trigger.

  1. Trigger setup as Public User Session Created
  2. Call Rest Resource Asset using IPData service as a test GEO IP lookup and use Session Var Name to set global variable.
  3. Persona asset to set to look for %globals_session_varname% with pattern of region.

And this serves the regional or personalised content for that region. Altough this solution is only based on session I think further development can include setting it at cookie & context level by using JS API.


(rocky balboa) #4

You have to do some steps to create the content on the external GEO API. First, you have to log in through your google account and then go to the cloud platform. Then you have to select the create option from the menu. Here you have to choose the API section. Make sure that you won’t have ERROR CODE 0XC0000428 while doing the process.


(Tbaatar) #5

Hi,

Thanks for the suggestion.

We are currently looking into CloudFlare geolocation with Amazon Lambda to grab custom header with location codes, and hopefully we can use the other header request method in context to switch the geo local at server level.


(Tbaatar) #6

Hi,

Is there a way to change context based on Reponse Headers as opposed to Request Headers?

I’m trying to change the context based on first load but can’t see anything in the context configuration.

Thanks.


(car keny) #7

You must have at least one API key associated with your project. make sure you are not facing issues like hulu error code 5003 mac on your device.