Injecting Demandbase attributes into rich text
This Step is optional, it allows you to inject whatever demandbase attributes are associated with the current user into rich text. Through integration with another 3rd party module Token Manager
The Sitecore Tokenmanager is a Sitecore Module that allows content authors to inject dynamic or managed content into a rich text field. This is particularly useful for Demandbase as it allows us to inject demandbase data into our content.
Installing Token Manager
Token Manager is available to install via nuget using visual studio or the package manager console command: Install-Package Token Manager. Install into your web solution and make sure the dll is in the bin folder and configuration file (tokens.config) is under App_Config/Include.
Integrating with Demandbase
There is nothing to do here, Token manager will detect the token definitions which are contained within the Demandbase module and wire up the tokens for use automatically. So simply install Token Manager and you're done.
Injecting Dynamic Attribute
After installing there will be a new button in the rich text editor that looks like an orange lightning bold. If you click this button you will be shown a form to fill out for which attribute you would like to inject onto the page. During edit mode this will show up as a blue highlighted placeholder reporting what attribute will be returned. Once outside of edit mode it will be resolved into a value for the particular attribute based on the user viewing the page.
Testing attribute based personalizations
There is a widget included in preview mode to simulate a particular ip. With this we can render the page as it would be seen from a particular consumers ip. This works by setting a cookie in your browser, once you have the cookie set you will impersonate that ip until you erase it from the widget or clear your cookies. However an important note is that in order to test personalization you need to be in normal rendering mode. You can enter normal mode by changing the sc_mode query string parameter to sc_mode=normal.
ALTERNATIVE TO IP WIDGET
Spoofing an IP Address
- Set Cookie to Spoof IP Address: To spoof an IP address, you can create a cookie called “demandbasemockip” and set the value to the desired IP address. The effect would be the same as using the IP Address Simulator widget. Please find below additional reference information & tools for setting a cookie. Also, an important note is that in order to test personalization you need to be in normal rendering mode. You can enter normal mode by changing the sc_mode query string parameter to sc_mode=normal.
Utilizing personalization through a CDN
What it boils down to is a CDN caches the HTML output and whenever anyone requests a page it simply returns a flat HTML version of your page. This is amazingly powerful when it comes to getting fast response times, however it's almost completely incompatible with any form of dynamic content with a few exceptions.
CDNs will give the ability to white list pages that will always retrieve content from the source, in our case Sitecore. This requires foresight from content authors as well as cooperation from the team managing the CDN to white list any pages that are going to be personalized before the personalization is live.
It's very important that you make sure the white list of a page is intact before setting up personalization, otherwise when the CDN refreshes the page cache for a particular user it faces the risk of caching personalized content. At which point you could be delivering content for a specific target audience to everyone.
- Create an endpoint for personalization
- white list this endpoint to pass through the CDN
- Patch into Sitecore's conditional rendering engine to place an identifier instead of resolving the personalized placeholder
- On page load detect these identifiers and send them to your endpoint including the page guid and placeholder attempting to render
- Your endpoint will take the page id, as well as placeholder and return personalized html
Due to the simplicity, we would recommend the pass through of personalized pages approach.