0

My requirement is to set the language for the site based on the location. I planned to use a geo IP rule.

Referred to the below link but I'm not able to figure out how the geo ip rule should solve my requirement.

Sitecore custom personalization rule not appearing in Custom Rule Editor in Sitecore 9 update 2

  • What are you trying to achieve? Personalizing components based on a geo-based rule or settings the language of the site based on the location? You mention both, but those are actually different things.. – Gatogordo Jan 9 at 11:48
  • I was thinking by personalizing geo based up -language setting can be changed .correct me if am wrong – sindu Jan 9 at 14:48
  • If you want to change the language based on the geo ip data, that's a different approach. I'll write you an answer to explain.. – Gatogordo Jan 9 at 14:58
1

If you want visitors to be directed to a language based on their location, you can use the geo IP data from Sitecore. In Sitecore you can setup Geo IP location detection. This will add information to the Tracker about the location of your visitor. This information can be used for language detection.

What you need to do actually is create a language resolver and set the language based on the country in the visitor's tracker. There are some pitfalls though as you need to make sure the data is available (especially on a first request it might not yet be filled when you request the location). The trick is to postpone your code - make sure it's in the right pipeline (after the location data is in the tracker).

You can read how I did it (with code) on https://ggullentops.blogspot.com/2018/05/sitecore-context-language-geo-ip-location.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.