Parameter Templates DMS Personalization

Recently, I used Parameter Templates in Sitecore in conjunction with a component based architecture in the Layout Details to maximize the effectiveness of personalization with the DMS (Digital Marketing System) in Sitecore. This post will show the desired functionality, my approach to the achieve the desired functionality, and the implementation details.

Desired Functionality

The client uses 3rd party screeners in their Sitecore instance that are simply JavaScript activated. The client wanted the ability to add JavaScript snippets to the pages. Typically, these snippets would need to be added right before the closing body tag but occasionally some snippets needed to be in the head tag on a page-by-page basis.


The client would have been content with being able to add 2 different JavaScript snippets right before the body tag. However, this would require me to add the 2 fields named TopScript and BottomScript into the PageType template for those pages. These fields would be used on a page-by-page basis and so I decided not to clutter up the PageTypes items sections with unused multi-text fields that may just confuse Content Editors. In addition, if I took that approach the I couldn't impress the client with how to utilize personalization, which is a key component of the DMS. Once the client sees how this works then, in my experience, they start getting more excited about the abilities of the DMS and start implementing it more and more, which may equate to a higher ROI for the client, and more business for XCentium as a consulting firm aiding in DMS development efforts.  Lastly, the development effort is not much more for this approach vs. adding 2 fields to the PageTypes. Here is a brief example. Then just insert the snippet into the Code Snippet field. I created one for 4Q and Ethnio already in the /CDI/Data/Scripts folder. I will use these for reference. After these are created then I just need to click on the item where I want them assigned. For example, I will use /sitecore/content/CDI/Contact Us item to assign these scripts to. Once I click on the item I now click on the Presentation tab in the Ribbon and then click on the Details icon in the Layout chunk. That will open the Layout Details dialog box where I can manipulate the presentation layer elements i.e. layouts, sublayouts, personalization, etc. Once in the Layout Details dialog box, I click on Edit for the Default device and then click on Controls in the Device Editor dialog box. This will allow me to add/remove/personalize components for the Contact Us item. I want to add 4Q to the top of the page on load and the Ethnio script to the bottom of the page on load. Hence, all I have to do is click on the Add button, then click on the Scripts component folder and then click on the ScriptsComponent sublayout. Once the Scripts Component sublayout is selected, I will need to add it to either the "TopScripts" placeholder or the "BottomScripts" placeholder in the Add to Placeholder field depending on whether I want the script to appear in the top of the page on load or in the bottom of the page on load. For example, I created 1 ScriptComponent and added to the TopScripts placeholder, and 1 ScriptComponent and added to the BottomScripts placeholder. Now I need to select the snippets to render from the /Data/Scripts folder that I created earlier so I just double-click on the sublayout in the Device Editor dialog box and now I can select the snippets in the JavaScript Code Snippets section.