I created a relatively basic datalayer that a couple of our analytics platforms are able to use. It's a javascript-based component that is added to the page header. There are some extras there that we aren't using right now (like Category), and I've shared the contents of the component below. custom-analytics-data-layer_js <#import "custom.common-helper" as commonHelper > <script type="text/javascript"> <#if user.anonymous> <#assign user_sso_id = "Anonymous"> <#assign user_type = "" /> window.username; <#else> <#assign user_sso_id = 'SSO_Missing'/> <#assign query = "SELECT sso_id FROM users where id='${user.id}'"/> <#assign SSORes = restadmin("2.0","/search?q=" + query?url) /> <#if SSORes?? && SSORes.data?? && SSORes.data.items?? && SSORes.data.items?size gt 0 && SSORes.data.items[0].sso_id??> <#assign user_sso_id = SSORes.data.items[0].sso_id/> </#if> <#assign window_username = user_sso_id> <#assign user_type = commonHelper.getUserType(user.id) /> window.username = "${window_username}"; </#if> var digitalData = { "page": { "pageInfo": { "pageName": document.title }, "category": { "primaryCategory": "", } }, "user": { "userType": "${user_type}", "userId": "${user.id?c}", "loginId" : "${user.login}", "sso_id" : "${user_sso_id}" } }; window.digitalData = digitalData; window.userType = digitalData.user.userType; </script> commonHelper is used to get the userType (employee/partner/customer/guest/etc. based on roles and might not be relevant for you. I'm curious what others might be doing here that we could or should add. EDIT: Sorry the formatting didn't paste in here. Can share as a txt file if desired.
... View more