Persona detection through Global Session Var


(Tbaatar) #1

Hi,

I’m working on a region detection using the Call Rest Resource Asset trigger to pass user IP to localisation finder API and set response ISO country code to a global session which can be picked up by the persona asset and content variation.

All works fine but with 1 problem. When accessing from the top level domain e.g www.mydomain.com it doesn’t work. But if accessed from index page e.g www.mydomain.com/home it works.

Why is that? and is there anything I can do to make it work from TLD?

Many Thanks.


(Tbaatar) #2

Here is more visual way to show what is happening.

1/ When you access the website from Top Level Domain e.g api.mn it fails to pick-up the Persona/Content Variation

2/ But if the same page is accessed through the index or lowerdown pages it picks up the Persona/Content Variation

  1. Subsequently going back to the TLD will now show the correct region

Is this to do with the fact that you can’t have content variation at site level and the index (home) does not expose content variation to the TLD?


(Tbaatar) #3

No feedback?

How does one detect region and serve the correct data with Squiz + any 3rd party implementation on first load without doing the hack double refresh with cookie method?


(Tbaatar) #4

Hoping Bart will power through all unanswered posts with an answer…wether it is possible or there is issue with Matrix CMS supporting this method for the time being so that I should be looking at different implementation method :slight_smile:


(Emily) #5

Hi Tbaatar,

I’m not sure I can help with your question directly, but since no one else has responded yet I will tell you a bit about a setup that I have used that is working for me… I don’t know if its the BEST way, but it is a way.

Not sure about your direct vs /home versions, other than to check that you have setup the Variation on the Site asset also?

What version of Matrix are you using? (Different versions do/don’t have certain features)

One site I work on we do use page Variations based on Locations, but we are not doing this using Global Session Variables. We use the “Variables” screen of the Standard Page, and have one Variation per region.
e.g. Variation 1 “Australia” is linked to using Persona “AU”.
Persona “AU” uses “Server Side Evaluation Settings” to look for a specific cookie (%globals_cookie_country% is what we named out cookie “country”), and the pattern is “AU”. For good measure, we also added in patterns of “Au” and “au” just incase they get stored with other capitalisations.
You might be able to use a session variable or something to set this cookie, but we already had a custom JS code that included the Country cookie (and more) so we used the existing cookie being created for the Country code.

Not sure this will help, but hope it might.


(Tbaatar) #6

Hi Emily,

Thanks for the reply.

We are using Squiz Matrix v5.4.3.1 for production and I’m testing it out with the v5.5.4.2.
The problem is that the content variation option is only available for standard page asset and the Site ‘earth’ does not seem to use index page content variations OR it has limitations.

I suspect the method that you are using is via the Cookie which is usually on the 2 hit process as it sets the cookie on first hit and on the second it either refreshes the page again or sets a redirect at which point it picks up the region.

The cookie method is what we have setup already and this is not a very reliable solution as it requires JS and it sometimes can fail which means we set a cookie with the wrong region and it causes lot of issues such as incorrect info, price etc.

The best method is to serve the region via the header on first hit, which we think it is possible with third party implementation such as AWS Lambda or maybe a server side implementation (if it exists) or my solution of Session Var / Persona detection to set the region on 1st hit and apply the cookie at the same time so it can be served from cookie on future visits.


(Bart Banda) #7

That sounds weird, might be a bug, but not sure. Is there any more info you could share of the implementation?

Maybe try with another persona that checks on a query string and do a simple test with that as well to see what you get?

I can’t replicate the issue on the latest 5.5.5 version.