1

I am working on a POC for a potential client using the sandbox that Sitecore has provided. This is for a localhost Sitecore website. Here are the steps:

  1. I created an alert banner that should appear at the top of the site.

  2. I added the following code to my solution and published my code successfully. However, when I preview the site through the personalize dashboard, the alert banner does not show. What I might be missing?

     <script type="text/javascript">
     // Define the Boxever queue
     var _boxeverq = _boxeverq || [];
     // Define the Boxever settings
     var _boxever_settings = {
         client_key: '<<I used the key provided by Sitecore>>', // Replace with your client key
         target: 'https://api-us.boxever.com/v1.2', // Replace with your API target endpoint specific to your data center region
         cookie_domain: '{{cookieDomain}}', // Replace with the top level cookie domain of the website that is being integrated e.g ".example.com" and not "www.example.com"
         javascriptLibraryVersion: '1.4.8', // Replace with the latest Boxever JavaScript Library version"
         pointOfSale: '<<POS>>', // Replace with the same point of sale configured in system settings" (I created this POS in the Personalize System Settings)
         web_flow_target: 'https://d35vb5cccm4xzp.cloudfront.net', // Replace with path for the Amazon CloudFront CDN for Sitecore Personalize"
         web_flow_config: { async: false, defer: false } // Customize the async and defer script loading attributes
     };
    
     // Import the Boxever JavaScript Library asynchronously
     (function() {
         var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true;
         s.src = 'https://d1mj578wat5n4o.cloudfront.net/boxever-1.4.8.min.js';
         var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
     })();
     </script>
    

UPDATE : Error in the network tab: I have used the key that Sitecore provided. The same key is in the Personalize System Settings as well

{
"version": "1.2",
"status": "UNAUTHORIZED",
"error_msg": "Invalid client key specified",
"moreInfo": "mailto:[email protected]",
"clientKey": "[[Key]]"
}
3

1 Answer 1

1

Your script looks good. Please check the following things:

  • Is Boxever available? Check e.g. Boxever.browser_id in your console.
  • Does your POS match the one you configured in Sitecore CDP? ´
  • Does your cookieDomain match this: '*.yourwebsite.com'?
  • When you open the preview on your website, if the QA tool appears on the left, can you check that?
  • If it does not appear here is the trick to call it: Call your website with the missing queryparams: https://www.yourwebsite.com/?bxQATool=true&bxFlowRef=your-experience-id . The experience ID you can copy from the url when you open your experience in Sitecore CDP. The QA tool should give you a hint, what might be wrong.

It would be good if you could share with us what you set up in Sitecore CDP.

6
  • Thank you - I do see an error in the N/W tab which I have added to the original post. The POS does match the one I configured. I had left the cookieDomain as it is optional. I did try the trick as well, but the QA toolbox doesn't show up. Maybe it is because of the 401 error which I am getting Dec 8, 2022 at 19:12
  • It's saying your clientKey is wrong - Can you re-check that? Dec 8, 2022 at 19:36
  • Ah you said you re-checked that. I am not sure if we can help you if the Client Key in Sitecore CDP - System Settings > API Access and in your script are the same. Is the "API Token Active" setting set to ON or OFF? Dec 8, 2022 at 19:43
  • 1
    I would make sure that you are using the correct API Url for the target. You mentioned using api-us.boxever.com, which would mean that you login with app-us.boxever.com to access your tenant, is that the case? That would be a potential reason why the client key is invalid, since those are defined per data center. The API Token toggle should not affect using the Stream APIs. Dec 9, 2022 at 3:29
  • 2
    That did it, thank you! Dec 9, 2022 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.