Integrating Sitecore CDP and Sitecore Send with Sitecore Forms
The age of the composable DXP is here and with that comes new integration challenges. Here I will explain how to use the Sitecore Forms module (which comes baked into Sitecore XM) to identify the user that submitted a form as contacts in CDP and Send.
A small caveat before we start, this technique can be used on Sitecore XP and Sitecore XM, but it isn’t recommended to use on Sitecore XM Cloud as the Sitecore Forms module is at time of writing an MVC module which is not supported on the new XM Cloud product.
Step 1 — Sitecore Forms pipeline extension for successful submission callback
We need a way to hook into the lifecycle of the forms on the page, to build up the contact data and then to submit the identify contact event on successful submission. We can do this via a pipeline extension which will trigger an event which can be subscribed to on the client side.
Step 2 — adding the CDP (Boxever) and Send (Moosend) scripts to your pages
You’ll need to add the js setup scripts for the two products.
- For CDP — Activating the JavaScript library
- For Send — Follow this guide
Depending on your front-end stack, be it SXA, MVC, or Headless (JSS), your approach on where you add those might differ.
If you’re using GTM then that could likely be a good place to add them.
If you’re on SXA then I’d recommend adding them as a HTML Snippet to your global meta Partial Design. The advantage there is it can be more easily managed between different environments. If you’re on MVC or Headless then you likely have a previously established pattern for this kind of thing already.
Step 3 — Custom JS to build the contact and hook into the form submission event
Here I’m making use of jQuery based on a previous pattern in the SXA solution I’m using for this example.
At a high level, the script does the following:
- Send page view events to CDP and Send
- Monitor all Sitecore Forms for firstname, lastname, and email fields and build up the contact client data layer.
- On form submission success, identify the contacts in CDP and Send.
It’s worth noting that all contacts that are identified in Send will be added to a default subscription list. If you need to add to a different specific list, there are examples on the moosend doc site on how to do that.