﻿![]()

#### 

#### Review Sitecore Send Tracking API

In previous blog we talked about configuring Abandoned Cart with Sitecore Send.
The suggested way to implement tracking is to use **Moosend Javascript API**.
There are some **downsides** with it:

- Front end needs to be changed
- Additional tracking library needs to be imported onto site
- It's one more JS integration in addition to default set: Google Analytics, Facebook Pixel and etc.

But it's possible to implement it with [Sitecore CDP](https://www.brimit.com/blog/cdp-0-intruduction). Unfortunately we can't use Javascript Tracking API there. Instead we need implement Tracking without JS API just with **HTTP Requests** with required payload sent to Tracking URLs. Lets take a look how to implement it.

#### Search for sources

The sources of Moosend tracking library can be easily found on [Github](https://github.com/moosend/website-tracking-js).

After some investigation of sources we found [Tracker.ts](https://github.com/moosend/website-tracking-js/blob/5c0e1bdd51928f7e6b33a7ad76060a4233b80917/src/tracker/Tracker.ts) and [config.ts](https://github.com/moosend/website-tracking-js/blob/5c0e1bdd51928f7e6b33a7ad76060a4233b80917/src/common/config.ts). 

Basically we can see, that requests are made to `https://t.stat-track.com` host to paths `/identify` or `/track` - based on the event type.

*Note*. It's also file [EXAMPLE-0.4.0.md](https://github.com/moosend/website-tracking-js/blob/master/docs/EXAMPLE-0.4.0.md) in this repository, but it's outdated: wrong payload is provided there.

#### HTTP Requests for Abandoned Cart tracking

Now lets review the request made for each type of event required for Abandoned Cart Tracking.

##### Identify request

This request is made when the user's email is known.

*POST* `https://t.stat-track.com`

```
{
   "ContactEmailAddress":"[USER_EMAIL]",    // users' email
   "ContactId":"[USER_ID]",                 // unique user id
   "actionType":"IDENTIFY",
   "sessionId":"[SESSION_ID]",              // unique session id
   "siteId":"[SITE_ID]"                     // site id from Moosend settings
}
```

The key thing here is known email and user identifiers:

- `ContactId` - unique user identifier, stays the same for multiple user sessions
- `sessionId` - unique session identifier, stays the same per particular user's session, but is different per others user sessions.

`[USER_EMAIL]`, `[USER_ID]`, `[SESSION_ID]` will be used in all others requests.
`[SITE_ID]` is the same for requests for all users in scope of single Moosend integration.

##### Add to cart request

This request is made when user adds something to the shopping cart.

*POST* `https://t.stat-track.com/track`

```
{
   "ContactId":"[USER_ID]",
   "actionType":"ADDED_TO_ORDER",
   "sessionId":"[SESSION_ID]",
   "siteId":"[SITE_ID]",
   "ContactEmailAddress":"[USER_EMAIL]",
   "properties":[                               // information about added to the cart product
      {
         "product":{
            "itemCode":"[PRODUCT_ID]",          
            "itemPrice":10,                     // product price - decimal
            "itemQuantity":2,                   // added quantity
            "itemTotalPrice":20,                // itemPrice * itemQuantity
            "itemUrl":"[PRODUCT_URL]",
            "itemName":"[PRODUCT_NAME]",
            "itemImage":"[PRODUCT_IMAGE]"
         }
      }
   ],
   "Url":"[CURRENT_PAGE_URL]"
}
```

##### Order completed request

This request is made when the order is completed. Also, list of products needs to be included into the payload:

*POST* `https://t.stat-track.com/track`

```
{
   "ContactId":"[USER_ID]",
   "actionType":"ORDER_COMPLETED",
   "sessionId":"[SESSION_ID]",
   "siteId":"[SITE_ID]",
   "ContactEmailAddress":"[USER_EMAIL]",
   "properties":[
      {
         "products":[
            {
               "itemCode":"[PRODUCT_ID_1]",
               "itemName":"[PRODUCT_NAME_1]",
               "itemPrice":10,
               "itemImage":"[PRODUCT_IMAGE_1]",
               "itemUrl":"[PRODUCT_IMAGE_1]",
               "itemQuantity":2,
               "itemTotalPrice":20
            },
            {
               "itemCode":"[PRODUCT_ID_2]",
               "itemName":"[PRODUCT_NAME_2]",
               "itemPrice":20,
               "itemImage":"[PRODUCT_IMAGE_2]",
               "itemUrl":"[PRODUCT_IMAGE_2]",
               "itemQuantity":3,
               "itemTotalPrice":60
            }
         ]
      }
   ],
   "Url":"[PAGE_URL]"
}
```

#### Upcoming

In the next articles we will keep reviewing Sitecore Send and we'll start implementing integration with Sitecore CDP.

#### Sitecore Send Series

[Abandoned Cart with Sitecore Send](https://www.brimit.com/blog/sitecore-send-1-abandoned-cart)

[Sitecore Send Http API](https://www.brimit.com/blog/sitecore-send-2-http-api)

###### Author

[!\[Igor Zharikov - Senior Sitecore Developer, Sitecore MVP\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/igor-zharikov-2.jpg?h=700&amp;iar=0&amp;w=700&amp;hash=292A84E8CB3E5CE57CA743385CFB1464)
Igor Zharikov
Sitecore MVP / Senior Sitecore Developer](https://www.brimit.com/blog/author?authors=Igor%20Zharikov)

#### 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=1608493a-9ae4-43ea-ac8e-8e3397c1e18e&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=Sitecore%20Send%20Tracking%20HTTP%20API&amp;kw=Sitecore%20Send%20Tracking%20HTTP%20API&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fsitecore-send-2-http-api&amp;r=&amp;lt=268&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=293990)