﻿#### 

First of all, if you don`t have **Sitecore CDP app** account, please, follow instructions in my previous article to get access to Sandbox environment.

1. Login to Sitecore CDP app, navigate to **System Settings -&gt; API Access** and copy **Client Key** value: ![Sitecore CDP Client Key](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/1/client_key.png)
2. In Sitecore CDP app navigate to **System Settings -&gt; Points of Sale** and create new point of sale with values that match your website hostname: ![Sitecore CDP - Create Point of Sale](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/1/point_of_sale.png)
3. Insert javascript snippet to your website layout and **replace client\_key, pointOfSale, cookie\_domain** with your values:

    ```
    
    <script type = "text/javascript"> 
        var _boxeverq = _boxeverq || [],
            _boxever_settings = {
                client_key: "xxxxxxxxxxxxxxxxx",
                target: "https://api.boxever.com/v1.2",
                cookie_domain: ".website.com",
                pointOfSale: "website.com",
                web_flow_target: "https://d35vb5cccm4xzp.cloudfront.net"
            };
    ! function() {
        var e = document.createElement("script");
        e.type = "text/javascript", e.async = !0, e.src = "https://d1mj578wat5n4o.cloudfront.net/boxever-1.4.8.min.js";
        var t = document.getElementsByTagName("script")[0];
        t.parentNode.insertBefore(e, t)
    }() < /script> 
    
    ```

    One more important variable is **web\_flow\_target**. It is missing in some examples from documentation. If you don`t have this variable – your experiences *(that you create in CDP app)* will be NOT displayed on your website.

    Your connection with Sitecore CDP is ready! It is time to test it.
4. To test your connection you should trigger **\_boxeverq.push** function in your website javascript:

    ```
    
    // Place an anonymous function in the Boxever queue 
    _boxeverq.push(function() { 
        var viewEvent = {
            "browser_id": Boxever.getID(),
            "channel": "WEB",
            "type": "VIEW",
            "language": "EN",
            "currency": "EUR",
            "page": "/home",
            "pos": "website.com"
        };
        //Add UTM params
        viewEvent = Boxever.addUTMParams(viewEvent);
        // Invoke event create 
        // (, , )
        Boxever.eventCreate(viewEvent, function(data){}, 'json');
    });
    
    ```

    Make sure that **pos** variable value match your hostname and CDP`s point of sale. Here is example of my extention that I use for event triggering:

    ```
    
    export const sendBoxeverEvent = (type, options, callback) => { 
      const { page, currency } = options; 
     
      _boxeverq.push(function () { 
        const boxeverEvent = { 
          browser_id: Boxever.getID(), 
          channel: 'WEB', 
          type: type, 
          language: getCookie('lang').toUpperCase() || 'EN', 
          pos: window.location.host, 
          currency: currency || 'EUR', 
          page: page || '/'
        }; 
     
        Boxever.eventCreate( 
          boxeverEvent, 
          function (data) { 
            if (callback) callback(); 
          }, 
          'json' 
        ); 
      }); 
    };
    
    // example of usage:
    sendBoxeverEvent('VIEW', {page: window.location.pathname});
    
    ```
5. Once javascript **\_boxeverq.push** is triggered, you can see JS request with your values to **api.boxever.com** in browser Network tab: ![Sitecore CDP - Inspect Request](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/1/request_inspector.png)

    If you see this request, this means that yout event was successfully pushed to Sitecore CDP app. ***BUT one note***: if your website visitor is anonymous, you will NOT find this event immideatelly in CPD app at Guest section.

    So, if you want to be 100% sure that your event successfully comes to CDP you can trigger **IDENTITY** request and provide any identifier variables like email:

    ```
    
    _boxeverq.push(function() { 
        var identityEvent = {
            "browser_id": Boxever.getID(),
            "channel": "WEB",
            "type": "IDENTITY",
            "language": "EN",
            "currency": "EUR",
            "page": "/home",
            "pos": "website.com",
            "email": "myemail@gmail.com",
            "firstName": "First",
            "lastName": "Last"
        };
    
        Boxever.eventCreate(identityEvent , function(data){}, 'json');
    });
    
    ```

    You can execute this request for testing in your website browser console and make sure that response status is OK: ![Sitecore CDP - Identity request](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/1/req1.jpg)![Sitecore CDP - Identity response](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/1/req2.jpg)

Your new user should appeared in **Customer Data -&gt; Guest** section almost immideatelly: ![Sitecore CDP - New Guest](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/1/response.jpg)

If you don`t see your created Guest and your triggered events in **Sitecore CDP** app - just double check that your hostname matches your pos value in your requests and matches *Point of Sale* in **Sitecore CDP**.  This is usually the main reason of connection issues.

*More information about website connection on [Sitecore Knowledge Hub](https://sitecore.cdpknowledgehub.com/docs).*

Here goes the table of contents for my Sitecore CDP blog series:

- [Introduction](https://www.brimit.com/blog/cdp-0-intruduction)
- How to connect Sitecore CDP to website
- [Debugging tools](https://www.brimit.com/blog/cdp-2-debugging-tools)
- [How to pass extended data to Sitecore CDP](https://www.brimit.com/blog/cdp-3-how-to-pass-extended-data-to-sitecore-cdp)
- [How to use Data System connections (Decision model with Content Hub products)](https://www.brimit.com/blog/cdp-5-how-to-use-data-system-connections)
- [How to use AI connections (Web experience with Azure Cognitive Services)](https://www.brimit.com/blog/cdp-4-how-to-use-ai-connections)
- [How to use Destination connections (Triggered experience webhook)](https://www.brimit.com/blog/cdp-6-how-to-use-destination-connections)
- How to use External service connections (Flows with External Service)
- Remarketing with Sitecore CDP and Facebook Ads

###### Author

[!\[sergey-200\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/sergey-200.jpg?h=197&amp;iar=0&amp;w=200&amp;hash=0D636570F87F1C13C39E06EB19D9DF06)
Sergey Baranov
Sitecore MVP/ Senior Sitecore Developer](https://www.brimit.com/blog/author?authors=Sergey%20Baranov)

#### More on Sitecore

[!\[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides#How-toDXPE-commerce
##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects
Optimize and accelerate the development and deployment of complex multisite Sitecore projects.
Alexei Vershalovich on July 17, 2024](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

[!\[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-toDXP
##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story
How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.
Sergey Baranov on October 2, 2023](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

[!\[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-toDXPE-commerce
##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)
Discover how a headless CMS can benefit organizations that use Sitecore.
Daniil Raschupkin, Palina Trokhautsava on September 15, 2022](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)

![](https://bat.bing.net/action/0?ti=187017043&amp;tm=gtm002&amp;Ver=2&amp;mid=4eaf14f8-ec39-4270-8df8-4c664007660e&amp;bo=2&amp;gtm_tag_source=1&amp;pi=0&amp;lg=en-US&amp;sw=800&amp;sh=600&amp;sc=24&amp;nwd=1&amp;tl=Dive%20into%20Sitecore%20CDP%20-%20How%20to%20connect%20Sitecore%20CDP%20to%20website&amp;kw=sitecore%20CDP&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fcdp-1-how-to-connect-to-website&amp;r=&amp;lt=289&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=938966)