1

We have requirement where based on Country User comes from Datasource should change corresponding to that country for example if User is accessing Site from China then Datasource should point towards China folder and if he is logging from UK it should point towards from UK folder

As shown in screen shot below.Any Inputs how this should be doneenter image description here

2

You can use personalization rule for your footer component.

There is a rule in GeoIP section:

where the country [compares to] [specific country]

If you're not using paid services, you may need to implement custom IP to country detection. But there are plenty of articles about GeoIP detection with free MaxMind databases, e.g:

http://www.craigtaylor.us/2013/08/creating-geoip-lookup-provider-for.html

Keep in mind that all the GeoIP databases are not perfect.

Remember also that you should define default datasource which will be used if you have no datasource for that particular country.


EDIT after OP's comment: If you're not using xDB, you can do the same just using session/cookie instead of saving this information in contact. Find country based on user IP using free MaxMind database (or other db), set this info in cookie/session, copy code of geoip country rule and change it to compare country from cookie/session instead of xdb.


EDIT after anothe OP's comment: In order to personalize a Sitecore component, you don't need to write any code: https://doc.sitecore.net/sitecore_experience_platform/digital_marketing/personalization/walkthrough_personalizing_components

You can personalize without xDB, see here: https://sitecore.stackexchange.com/a/4769/277

  • In this case, are they personalized components or actually personalizing the datasource on the fly, via a rule. The ladder would be awesome, but I think it can only be done via a controller rendering. Thanks Marek. – Chris Auer Dec 8 '17 at 15:05
  • 1
    @ChrisAuer I'm not sure I understand your comment correctly. There is a built-in Sitecore rule. You can personalize the component. If you don't have paid geoip subscription, you can always add your own processor to httpRequestBegin pipeline, find the country based on user's IP address and set it on the current contact. And they use the built-in personalization rule on any component on the site as you would do if you had paid geoip subscription. – Marek Musielak Dec 8 '17 at 15:11
  • We are not using Sitecore XDb so we can't use Sitecore personalizing rules it has to be done only using Sitecore API's.how can we do this using controller rendering – user2332873 Dec 8 '17 at 15:16
  • You can do the same just using session/cookie instead of saving this information in contact. Find country based on user IP using free MaxMind database (or other db), set this info in cookie/session, copy code of geoip country rule and change it to compare country from cookie/session instead of xdb. – Marek Musielak Dec 8 '17 at 15:21
  • No code needed. Just use personalization doc.sitecore.net/sitecore_experience_platform/digital_marketing/… – Marek Musielak Dec 8 '17 at 16:04

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.