- [Home page](https://www.brimit.com/)
- [Blog](https://www.brimit.com/blog)

# Dive into Sitecore CDP - How to use Destination connections (Triggered experience webhook)

[#How-to](https://www.brimit.com/blog?categories=#How-to) [DXP](https://www.brimit.com/blog?platforms=DXP)
[Sergey Baranov](https://www.brimit.com/blog/author?authors=Sergey%20Baranov) on November 19, 2021

There are 3 types of connections in **Sitecore CDP**:

1. ***Data System*** - can be used in Decision models as external source of data.
2. ***AI*** - can be used in Decision models as a logic block that performs any calculations on external service side.
3. ***Destination*** - can be used in Full stack experiences to send data to external services.

![Sitecore CDP - Destination connections](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/types_of_connections.jpg)

In this article I`ll show how to create **Destination**connection to **Facebook Conversions API** and use it in triggered experiense to forward events to **Facebook Ads**.

#### How to create connection to Facebook Conversions API?

First of all, you need to have installed [Facebook Pixel](https://developers.facebook.com/docs/facebook-pixel) on your website. In your facebook account navigate to **Events Manager -&gt; Pixel app -&gt; Settings** and generate token for Conversions API:

![Sitecore CDP - Facebook Conversation API token](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/access_token.jpg)

The second key that you need is **Pixel ID**:

![Sitecore CDP - Facebook Ads Pixel ID](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/pixel_id.jpg)

Once you have **Pixel ID** and **token** it is time to test connection. In your facebook account navigate to **Events Manager -&gt; Pixel app -&gt; Test Events,** copy test event code *(TEST37153 in my case)* for future testing in Sitecore CDP and open **Graph API Explorer**:

![Sitecore CDP - Test Facebook Events](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/facebook_test_events_2.jpg)

Insert your token in **Access Token** input and click submit button:

![Sitecore CDP - Facebook developer console](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/facebook_console_2.jpg)

If you see response like on screenshot above, your connection is OK. If you return to **Test Events** tab you will see that your event is successfully tracked:

![Sitecore CDP - Facebook events tracking](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/facebook_test_success.jpg)

#### How to setup Facebook Conversions API connection in Sitecore CDP?

Login to your Sitecore CDP application account, **Connections -&gt; Add Connection-&gt; Destination**. Enter *Name* and *Description* of your connection,  choose *None* on Athentification tab and configure request parameters:

- **Method**: POST
- **URI**:  [https://graph.facebook.com/v12.0/{pixel\_id}/events?access\_token=](https://your_CH_endpoint/api/entities/query?query=Definition.Name=='M.PCM.Product'&members=ProductName,ProductPrice){token}

Replace {pixel\_id} and {token} with your real values. To test your connection copy resuest body from recently tested facebook Graph API explorer:

![Sitecore CDP - Destination connection to Facebook](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/cdp_test.jpg)

If you testing request is successfull,  you will see recieved event in facebook **Test Events** tab. Save your connection with default mappings, don`t worry about testing Request body: it will be overwritten in triggered experience webhook in the future.

#### How to configure triggered experience?

In Sitecore CDP navigate to **Experiences -&gt; Full Stack -&gt; Create Experience -&gt; Triggered Experience**. In **Choose Connection** popup select your recently created Facebook destination connection:

![Sitecore CDP - Triggered Experience](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/triggered_experience.jpg)

For this demo I`ll show you how to forward *VIEW* event from your website to **Facebook Conversions API** *(for your real solution you can add more events as a trigger)*. Navigate to **Trigger** section and add custom trigger as shown on image below:

![Sitecore CDP - Add event trigger](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/view_trigger.jpg)

Go to **Webhook Composer** section and click on *Edit* button. Paste this Freemarker code into **API** tab:

```

<#assign pageUrl = "https://" + entity.pointOfSale + entity.arbitraryData.page>
<#assign timestamp = (.now?long / 1000)?floor?c>
<#assign guestUnique = guest.ref?replace("-","") + guest.ref?replace("-","")>
{
   "data": [
      {
         "event_name": "ViewContent",
         "event_time": ${timestamp},
         "event_source_url": "${pageUrl}",
         "action_source": "website",
         "user_data": {
            "em": "${guestUnique}",
            "client_user_agent": "Sitecore CDP"
         }
      }
   ],
   "test_event_code" : "TEST37153"
}

```

Parameters explanation:

- ```
    event_time - timestamp of triggered event in unix format (in seconds),
    ```
- ```
    user_data.em - any unique identifier of user in sha256 format. Unfortunatelly, I didn`t find how to caclulate sha256 in Freemarker, so for this demo example I just concatenate 2 times guest.ref value that is unique user identitier and looks like sha256; for real solution I store already sha256-hashed value of user email in extended guest profile properties.
    ```

Start your experience, navigate to your website and [generate some *VIEW* events](https://www.brimit.com/blog/cdp-1-how-to-connect-to-website). Go to **your experience -&gt; Operations -&gt; Execution Repost** where you will see statuses of youe triggered *VIEW* events. If all is OK you will see *SUCCESS* status:

![Sitecore CDP - Triggered Experience Execution Report](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/trigger_success.jpg?w=768&hash=D32878CDA43FB2BBD1CFE1A076F563FB)

Because of we also passed **test\_event\_code** parameter, we can see that our events successfully hit facebook:

![Sitecore CDP - Success trigger](https://www.brimit.com/-/media/project/brimit/blog/2021/x3mxray/6/facebook_success.jpg)

*NOTE: Remove **test\_event\_code** parameter for production events.*

In the next article I`ll show you how to setup **Facebook Ads** with triggered experience more flexible by using decision modeling. Stay updated!

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](https://www.brimit.com/blog/cdp-1-how-to-connect-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)
- 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&iar=0&w=200&hash=0D636570F87F1C13C39E06EB19D9DF06)

Sergey Baranov

Sitecore MVP/ Senior Sitecore Developer
[Sergey Baranov](https://www.brimit.com/blog/author?authors=Sergey%20Baranov)

###### More By Categories

[#Events](https://www.brimit.com/blog?categories=#Events) [#How-to](https://www.brimit.com/blog?categories=#How-to) [#News](https://www.brimit.com/blog?categories=#News) [#Guides](https://www.brimit.com/blog?categories=#Guides)

###### More by Platform

[Data and AI](https://www.brimit.com/blog?platforms=Data%20and%20AI) [DXP](https://www.brimit.com/blog?platforms=DXP) [E-commerce](https://www.brimit.com/blog?platforms=E-commerce) [Internet of Things](https://www.brimit.com/blog?platforms=Internet%20of%20Things) [Sales and marketing automation](https://www.brimit.com/blog?platforms=Sales%20and%20marketing%20automation)

#### 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-to DXP E-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
[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects](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-to DXP

##### 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
[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story](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-to DXP E-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
[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)
