Enabling Noibu's SFCC log integration creates a direct link between sessions in Noibu and log entries in SFCC, so you won’t have to switch back and forth between the two tools to collect insights on SFCC errors. The requirements to enable SFCC log integration on a domain in Noibu are as follows:
- Create a New SFCC Client ID for Noibu
- Access the SFCC Session ID
- Add SFCC Session ID as a Custom Attribute
Please note that SFCC log integrations are configured on a per domain basis. To integrate SFCC logs with multiple domains, you must configure each domain individually. However, you can reuse SFCC credentials on multiple domains.
Create a New SFCC Client ID for Noibu
- Create a New SFCC API Client from the Account Manager panel in Salesforce. Save your client ID and password; you must share these with Noibu later.
-
Configure WebDAV Client Permissions for the new client ID, and use the JSON snippet below to grant the client read access to your logs. Be sure to replace the
<your-client-id-here>
placeholder with the actual client ID value.{
"clients":[
{
"client_id":"<your-client-id-here>",
"permissions":[
{
"path":"/logs",
"operations":[
"read"
]
}
]
}
]
} - Use Noibu's Retool App to validate the access credentials and share them with Noibu.
- Contact your Noibu CSM to retrieve the password for the Retool app.
The app will perform the following processes:
- Validate that the authentication is successful
- Validate that Noibu has read access to your domain's SFCC logs
- Save the encoded credentials to our database
Retreive the SFCC Session ID
To map SFCC logs to session data in Noibu, you must configure the SFCC session ID as a custom attribute. SFCC Logs contain Truncated SessionID
entries, and Noibu can use these entries to connect session recordings to SFCC logs. This value is the first 10 digits of the dwsid
HTTP cookie. Do not confuse this with the sid
cookie.
The process here reads the SFCC session ID from the dwsid
cookie, truncating it to the first 10 characters, and stores it in the pdict
variable.
- Read the SFCC session ID from the
dwsid
cookie. By taking advantage of theapp.template.htmlHead
hook, you can capture the value and make it available from thepdict
.
exports.htmlHead = function (pdict) {
var cookies = request.getHttpCookies();
var dwsid = "";
var truncatedSessionId = "";
for (var i = 0; i < cookies.getCookieCount(); i++) {
if (cookies[i] && cookies[i].name == "dwsid") {
dwsid = cookies[i].value;
}
}
if (dwsid && !empty(dwsid)) {
truncatedSessionId = dwsid.substring(0, 10);
}
if (pdict) {
pdict.truncatedSessionId = truncatedSessionId;
}
}; - Use the
app.template.afterFooter
hook to render an ISML template.exports.afterFooter = function (pdict) {
var ISML = require("dw/template/ISML");
ISML.renderTemplate("noibu_custom_attribute");
}; - Validate that the value retrieved is correct by comparing it to the
dwsid
cookie value in the your browser's Developer tab.- Open the Developer tab, select
Application
, and clickCookies
. - Select your domain, and filter the list by typing
dwsid
. Verify that the first 10 digits of the cookie value match the value you set into thesfcc-session-id
cookie. It should look something like this:
- Open the Developer tab, select
Add SFCC Session ID as a Custom Attribute
Once you have access to your domain's SFCC session ID, share that value with Noibu by configuring a custom attribute through the NoibuJS SDK. The process listed here references the addCustomAttribute
function in the SDK Documentation.
Once you initialize the SDK, use the following code snippet to add sfcc-session-id
as a custom attribute on every page of your website. Please note that this snippet assumes you have already have a cookie called sfcc-session-id
that contains the first 10 symbols of the SFCC session id.
<isif condition="${pdict.truncatedSessionId}">
<script>
function checkSDKExistanceAndAddCustomAttribute(){
const sdkCheck = setInterval(() => {
if(window.NOIBUJS && window.NOIBUJS.addCustomAttribute){
clearInterval(sdkCheck);
window.NOIBUJS.addCustomAttribute("sfcc-session-id", "${pdict.truncatedSessionId}");
}
}, 3000);
}
checkSDKExistanceAndAddCustomAttribute();
</script>
</isif>
Learn more about SFCC Logs in Noibu.