Tag: Sitecore Send

Sitecore Send Custom Automation – Email when user subscribes to specific mailing list

If you want to send welcome email to the user subscribed to the specific mailing list in this example to a Newsletter, you can do so using Sitecore Send Automation.

In this case there is no OOTB automation available. Will crate a custom automation instead

To see how to setup a Subscribe abd Unsubscribe using javascript see this blog

Setting up Custom Autmation to Thanks user for subscribing to the Newsletter

Navigate to Automation and New –> Custom automation

Setting up Automation for welcome email-

This is avaiable in automation recipe-

Navigate to Automation and New –> From recipe

Update title and description of automation-

Select the trigger-

Choose the List Engagement option – When someone subscribes to a specific list

In this case I am choosing the Newsletter Email List- created in my other blog

This should update the automation-

Next add the condition or control step

For this example will choose – Wait a specific time interval-

So after the user subscribes to Newsletter the wokflow will wait for 1 minute to perform further action.

Select Send mail campaign action-

Fill in the appropriate fields and create action-

Automation Worflow should look like this-

Imp- do not forget to activate the automation workflow.

On subscribing to newsletter-

You should be able to see the user added to the Newsletter mailing list-

After a minute you should be able to see custom automation is triggered-

Result- Email been sent after subscription-

You can also choose the exisitng recipe but this has the trigger to send mail if the user subscribes to any list.

Choose Welcome email sequence option-

This should ne now available in Automation Workflows in an Incomplet state-

Should show up with the option to setup the Automation Workflow-

Might see mulitple such steps- update as per your requirements

Click on the Trigger – When someone subscribes to any list as highlighted


Siecore Send – Setup re-direction to a custom webpage after unsubscription

To setup subscription and un-subscription see this blog

In this case I am setting up the Newsletter mailing list if user un-subscribed redirects to the custom page.

Navigate to the mailing list to setup the unsubscription redirect page-

Select Set your settings option

Enter the Redirect page URL –

When the user unsubscribes to the email list, it will be re-drected to your custom page.

When the user unsubscribes to the mailing list-

Will be redirected to the configured custom page instead of standard Sitecore page.


Gracefully handle user subscription using Sitecore Send

In this blog will walk you through on implementing subscribing and ubsubscribing user from the mail list using Sitecore Send

Use hostname- https://api.sitecoresend.io/v3

Subscribing a user to a mailing list

Api endpoint to subscribe a user to a mailing list


Subscribe Code

function SubscribeNewsletter(){

              let email = document.getElementById("newsletteremail");

              if (email.value == "") {
                alert("Ensure you input a value in both fields!");
              } else {
                // perform operation with form input
                var request = new XMLHttpRequest();
                request.open('POST', 'https://api.sitecoresend.io/v3/subscribers/{maillist}/subscribe.json?apikey={apikey}');
                request.setRequestHeader('Content-Type', 'application/json');
                request.setRequestHeader('Accept', 'application/json');
                request.onreadystatechange = function () {
                  if (this.readyState === 4) {
                    console.log('Status:', this.status);
                    console.log('Headers:', this.getAllResponseHeaders());
                    console.log('Body:', this.responseText);
                var body = {
                  'Name': 'Sandeep Pote',
                  'Email': email.value,
                  'HasExternalDoubleOptIn': false
                email.value = "";
                alert("User subscribed to newsletter")

Unsubscribe a user from a mailing list

Api endpoint to un-subscribe a user to a mailing list


Unsubscribe Code-

function UnSubscribeNewsletter(){

              let email = document.getElementById("optout-newsletteremail");

              if (email.value == "") {
                alert("Ensure you input a value in both fields!");
              } else {
                // perform operation with form input
                var request = new XMLHttpRequest();
                request.open('POST', 'https://api.sitecoresend.io/v3/subscribers/{maillist}/unsubscribe.json?apikey={apikey}');
                request.setRequestHeader('Content-Type', 'application/json');
                request.setRequestHeader('Accept', 'application/json');
                request.onreadystatechange = function () {
                  if (this.readyState === 4) {
                    console.log('Status:', this.status);
                    console.log('Headers:', this.getAllResponseHeaders());
                    console.log('Body:', this.responseText);
                var body = {
                    'Email': email.value,                  
                email.value = "";
                alert("User subscribed to newsletter")

Looks simple, but you might see when the user un-subscribed from a mailing list the user is never sent a mail from other mailing list or any other transactional mail.

Set user to unsubscribe from a specific mailing list

To allow only to unsubscribe from the a specific mailing list update a Unsubscribe setting-

For this goto Settings –> Set your account settings in Sitecore Send and check the Unsubscribe settings

Select option- When unsubscribing users from a list send to them from other mailing lists

Now the user will be only unsubscribed from the specific mailing list and sending mails from the Other mailing list of capaign should be possible.

This setting is very important whilst working with Sitecore send.





Send Abandoned Cart email using Sitecore Send Automation

Sitecore Send lets you automate your communication with customers by identifying specific situations that trigger the sending of an email message

In this blog lets create automated mails using automation recipes.

For more details see this link.


Ensure the website is configured and verified before using the automation. See this blog. For this blog post I am using – https://moosend.vercel.app/

Create automation using Abandoned Cart automation recipe

Navigate to Automation link and create new automation using recipe-

Select Abandoned cart recipes-

Will be shown the Abandoned Cart Workflow-

Choose Trigger option-

Select- Trigger every time option

Select your website from dropdown and Save. Only verified website will be visible here. You may also choose all sites.

Open wait operation-

For testing I have selected 5 minutes. Ideally this can be few hours/days as per the requirement or enter specific date. By default it is 45 minutes. Enter the wait time and Save.

Setup the filter

Select apply this filter to mailing list. I have selected the email list of the site, you may select different list.

Enter the product if you wish to or leave empty.

Click on “Add a collection”.

Select the time if the product is not purchased for certain time. I have entered 6 minutes. Enter the details and Save.

Select “Added a Product To Cart” and filter value. In this I have added product “Americano”.

Select timer and enter the wait time to 6 minutes and Save

Select the action

In this case Send the mail to user if the product is not purchased in selected time.

Select Send Mail campaign-

Enter the subject, From address, mail body. Select Emails per day. Save once this option is filled.

Activate the “Abandoned Cart” automation-

Automation List with activated

Once the automation configuration is complete will now add product to cart. the product name here is “Americano” as selected in filter.

In the installation script you can find the details on how to add the product to cart.

function addToCart(){
                // mandatory - a unique code for the product, like its SKU
                    var itemCode = 'Americano';
                    // mandatory - the name / title of this product
                    var itemName = 'Iced Americano';
                    // mandatory - the image url of this product
                    var itemImage = 'http://your.store/product-color-blue.jpg';
                    // mandatory - the price of this product
                    var itemPrice = 10.25;
                    // mandatory - the url to get to the relevant product page
                    var itemUrl = 'http://your.store/product-101';
                    // mandatory
                    var itemQuantity = 1;
                    // mandatory - the total price for purchasing the given quantity of this product
                    var itemTotalPrice = 10.25;
                    // optional - the category of this product
                    var itemCategory = 'Drinks';
                    // optional - the manufacturer, brand name or company / owner of this product (if any)
                    var itemManufacturer = 'Acme Co';
                    // optional - the supplier of this product (if any)
                    var itemSupplier = 'Supplier Co';

                    // you can add custom properies and later use them in segmentations or automations
                    // You can track things like the color or the sze of the t-shirt in this case
                    var extraProps = {'flavor': 'Chocolate', 'type': 'Iced'};

                    // Tracking add to cart events with mandatory arguments
                    mootrack('trackAddToOrder', itemCode, itemPrice, itemUrl, itemQuantity, itemTotalPrice);

                alert("Added to cart event fired");

Hook the Add to cart to button-

<button class="button" onclick="addToCart()">Add to cart</button>

The site looks like this with the “Add To Cart” button

Website confirm the event was triggered.

In the automation list you can see the automation been Triggerd-

Once this is triggered you can see the next operation Wait for 5 minutes-

A mail should be triggerd after 6 minutes. Since the product is still in cart and not purchased.

After 5 minutes all the actions should be triggered.

Once all the actions are triggered should receive the mail-

Thats it for this blog. We have managed to trigger a automation event and send themail to the users who have product in the cart and not purchased e.e. Abandoned Cart.


Enable website tracking service using Sitecore Send

Sitecore Send website tracking service enables to collect data and makes it available for users. It uses cookie-based technology to track data on end-user page visits, product view, add to cart and purchase.

Add website to Sitecore Send


You need to have a website up and running. this can be a simple HTML site or you can choose any other web techology with any Fronetend framework like nextjs, react or jquery etc.

I have created a simple site and hosted using vercel – e.g.:- https://moosend.vercel.app/

To add a website to Sitecore Send –

Navigate to Account –> Websites or New Website option

List of Websites-

Should display list of Websites already configured and if its verified.

Add Website-

On this page enter your website url- https://moosend.vercel.app/

Once this is submitted it should show the Website Id alond with Connection Script. Website Id is required to add this in script to start tracking.

The website list should show the newly added website which should be in unverfied state-

Connect Website

Navigate to Install connection script option. Install button should show the script that is require to add to your website

Copy this script to you website head section, this may be different for you site –

mootrack('init', '77d7daa0-b906-4965-be85-7d8a8892019f');

The Id in the above code is website id.

Identify the visitor

To verify your site and to track the visitor use this script-

mootrack('identify', 'john@doe.com');

The above email will be identified.

Add script to you Website-

Add the above script in your website Head section, something like this-

The initila script which allows to use the mootrack fucntion with various options.

The mootrack init along with you website id

Local function to track user. I have hooked this function to a button

<button class="button" onclick="trackuser()">Track User</button>

Deploy the site to vercel-

I have deployed the site to vercel but you can choose your own hosting provider or the way you want to deploy the site.

My site looks like this and have button to “Track User”, “Add to cart” and “Checkout”

Click on “Track User” button, it should confirm the tracking.

This should also add cookie entry with user email-

And now you should see the website in Sitecore send should be in Verified state-

A new Email List will be created and a subscriber should have been added-

This concludes enabling the Sitecore Send for your website.


If you see this warning the site might not be tracking correctly due to cookie conflict. Delete all cookies before starting the tracking.