Regional Attributes
Regions let you use different product attributes such as list price, sale price, catalog names, and availability for groups of users. Typically, these users are from one geographic area or region-for example, an international retailer could set up one region for each country where they do business. (Regions can be used more abstractly so long as the basic requirements are met.)
To add region support, you need to:
-
Inform your Algonomy team, they will enable regions for your site.
-
Update your feed. The variable values are sent through the feed and associated to a region ID. See Product Region Flat File Feed for a complete list of attributes that you can set for a region.
-
Update your site integration. In the integration logic, you only identify the user’s region ID. When the region ID is known for a user, the recommendations that are returned use the available values for that region.
Notes:
-
The user does not need to be logged in.
-
Region ID can vary during a session.
-
If the feed didn’t contain region-specific data for a particular product, the recommendation shows the default product data.
Regions and Recommendations
In general, region data does not change the recommendations that are returned (except for products that are out of stock in certain regions). Regional information is substituted after recommendations are generated for a user. Backfill strategies become especially important when you’re working with sites with multiple regions.
Languages
By default, the language is determined by the region, as specified in the region feed file.
For example, you could configure a country like Switzerland with three regions and three languages:
-
RegionId: ch-FR, Region: Switzerland–France, Language tag: ch-FR
-
RegionId: ch-DE, Region: Switzerland–Germany, Language tag: ch-DE
-
RegionId: ch-IT, Region: Switzerland–Italy, Language tag: ch-IT
JavaScript Integration
How to make this code work for you
Add the following lines of code to your page tags, providing the required values.
Function |
Requirement |
---|---|
R3_COMMON.setRegionId('Region ID'); |
Replace Region ID with the ID that represents the current customer's region. The set of valid region IDs are determined by you and set up in the region feed. |
R3_COMMON.setLanguage('language_tag'); (optional) |
Use this to override the default language determined by the region. Replace language_tag with the desired language code (for example, en-US). |
Sample Code
Call setRegionId() and, if needed, setLanguage() in the Primary Code Block:
Primary Code Block
<!-- Place this code inside the <body> element as close to the top as possible -->
<script charset="utf-8" type="text/javascript">
var R3_COMMON = new r3_common();
R3_COMMON.setApiKey('abcd5432e1');
R3_COMMON.setBaseUrl(window.location.protocol+'//integration.richrelevance.com/rrserver/');
R3_COMMON.setClickthruServer(window.location.protocol+"//"+window.location.host);
R3_COMMON.setSessionId('6B4D397B');
R3_COMMON.setUserId('10987'); // if no user ID is available, please leave this blank
// Use this code if you are not requesting placement(s) for personalization
R3_COMMON.addPlacementType('home_page');
// Replace placement_name with the placement name you set up in Dashboard.
// Call multiple times to display more than one placement.
R3_COMMON.addPlacementType('home_page.placement_name');
// Send the region identifier for Switzerland, French area
R3_COMMON.setRegionId('ch-FR');
// Optional: override the default language for the region
R3_COMMON.setLanguage('en-US');
var R3_HOME = new r3_home();
rr_flush_onload();
r3();
</script>
API Parameter
You can also set the region ID in the recsForPlacements API using the rid parameter.
Example: rid=ch-FR