SalesForce Marketing Cloud (Push)

Salesforce Marketing Cloud is a digital marketing platform that helps businesses manage multichannel campaigns, including email, social media, and advertising. It enables personalized customer interactions through data integration and automation. This allows companies to optimize their marketing strategies and improve overall performance.

The SFMC integration allows you to send the AB Tasty campaign data to SFMC.

How Campaign Data Is Sent

 AB Tasty campaign data are sent in a dedicated Data Extension (DE) of SFMC with the following information: 

  • This AB Tasty event contains the  Campaign ID, Campaign Name, VariationID, VariationName and subscriberKey.  

AB tasty Hit (event)

Field Definition
campaignName Name of the AB Tasty campaign that is live on your website
campaignId ID of the AB Tasty campaign that is live on your website
VariationName Name of the current variation seen by a visitor on your website 
VariationID ID of the current variation seen by a visitor on your website
SubscriberKey VisitorID once they can be identifiable (must be provided by SFMC / SFCC)

 How to Set up the Integration

Requirements 

Global information

Because SFMC is a marketing tool, there’s no native way to identify one SFMC visitorId on your own website.

The SFMC integration pushes an AB Tasty hit on a server side way. 

That’s why, this integration between AB Tasty and SFMC only works with the following conditions: 

  • A visitorId must be identified (thanks to a login, a form, a newsletter, etc ..). We’re not able to send our AB Tasty event if one anonymous visitorId is on your website.
  • A correct technical implementation of SFMC, linked to SalesForce Commerce Cloud in order to retrieve the subscriber key (unique visitorID). 

Implementation SFMC with SFCC on your website

This step aims to provide you guidance on how to install and configure the AB Tasty ↔︎ Salesforce Marketing Cloud connector on your website. This guide does not contain any installation/setup steps regarding AB Tasty itself, nor Salesforce Marketing Cloud itself.

Purpose

The purpose of this connector is to provide a bridge between your website and the AB Tasty Javascript snippet so that the AB Tasty snippet gets the customer’s subscriber key when the user is navigating the website. This only works for “known" users, meaning people that exist in Salesforce Marketing Cloud and have been assigned a subscriber key.

Identify the correct installation chapter

Before jumping into the installation, you need to identify what is your actual architecture when it comes to how your website is integrated (or not) with Salesforce Marketing Cloud. Before jumping into the installation, you need to identify what is your actual architecture when it comes to how your website is integrated (or not) with Salesforce Marketing Cloud. Here is a simple chart to help you go in the right chapter of this document :

Installation guides

#1 You are not using Salesforce B2C Commerce Cloud to host your website

In case you are not using Salesforce B2C Commerce Cloud to host your website, you’ll have to implement two parts of the connector’s behavior to make it work:

  1. Integrate the JavaScript file into your website (either in the <head> tag or at the end of the <body> tag)
  2. Make sure to provide the customer’s subscriber key used in Salesforce Marketing Cloud within a <meta> tag with the name sfmc_subscriberKey. Here is an example: <meta name="sfmc_subscriberKey" content="subscriberKeyValueForTheCustomer" /> in the <head> tag. This should be done on all pages, or at least all the pages where AB Tasty is included on your website

#2 You are using Salesforce B2C Commerce Cloud to host your website

#2.1 You are using Salesforce Service Cloud, Salesforce Marketing Cloud and Salesforce B2C Commerce Cloud, and are following the solution kit to integrate them all together

In case you are using Salesforce Service Cloud, and integrated all three clouds by following the Salesforce solution kit, this means you are using b2c-crm-sync to resolve customer profiles between Salesforce Service Cloud and Salesforce B2C Commerce Cloud. The principle of the solution kit is that you should use the Salesforce Service Cloud Contact ID as subscriber key when sending customer profiles from Salesforce B2C Commerce Cloud to Salesforce Marketing Cloud. Thus, the subscriber key used in Salesforce Marketing Cloud is already known in Salesforce B2C Commerce Cloud, stored within the b2ccrm_contactId custom attribute of the profile.

#2.1.1 You are using SFRA

If all of this is the case, and you are using SFRA, then you can

  1. download the plugin_abtasty_sfmc_connector
  2. upload it to your Salesforce B2C Commerce Cloud instance
  3. add it to your cartridge path

The connector will automatically plug in a hook from the SFRA template to inject the <meta> tag and the Javascript file for authenticated customers in the <head> tag.

#2.1.2 You are not using SFRA

If all of this is the case, but you are not using SFRA, then you’ll need to:

  1. Integrate the Javascript file into the website (either in the <head> tag or at the end of the <body> tag). You can either store the file into one of your cartridge, or within the library of the site
  2. Make sure to provide the customer’s subscriber key saved in the customer profile b2ccrm_contactId custom attribute within a <meta> tag with the name sfmc_subscriberKey. Here is an example:
<meta name="sfmc_subscriberKey" content="subscriberKeyValueForTheCustomer" /> 

in the <head> tag. This should be done on all pages, or at least all the pages where AB Tasty is included on your website

#2.2 You are not using Salesforce Service Cloud, or not following the solution kit to integrate SFSC, SFMC and SFCC

#2.2.1 You are already saving the Salesforce Marketing Cloud subscriberKey onto the Salesforce B2C Commerce customer profile

In case you are not following the solution kit, but the Salesforce Marketing Cloud subscriber key is stored on the Salesforce B2C Commerce customer profile, then please follow these steps.

#2.2.1.1 You are using SFRA

If you are using SFRA, then you can leverage the plugin_abtasty_sfmc_connector cartridge, and need to overwrite the configuration file. Please follow these steps:

  1. download the plugin_abtasty_sfmc_connector
  2. upload it to your Salesforce B2C Commerce Cloud instance
  3. add it to your cartridge path
  4. in a cartridge that you manage, please create the file cartridge/scripts/abtasty_sfmc_connector/config.json, which will overwrite the one from the connector, and modify it as follows:
{
  "profileAttribute": "custom.attributeWhereSubscriberKeyIsSaved"
}

Note that you can provide both standard and custom attributes to this configuration, and the code will automatically try to load the value from a custom attribute if you provide “custom." or from a standard attribute if you don’t.

The rest of the plugin cartridge don’t need any extra change.

#2.2.1.2 You are not using SFRA

If you are not using SFRA, then you’ll have to implement the two components of the connector yourself by following these steps:

  1. Integrate the JavaScript file into the website (either in the <head> tag or at the end of the <body> tag). You can either store the file into one of your cartridge, or within the library of the site
  2. Make sure to provide the customer’s subscriber key saved in the customer profile within a <meta> tag with the name sfmc_subscriberKey. Here is an example:
<meta name="sfmc_subscriberKey" content="subscriberKeyValueForTheCustomer" /> 

in the <head> tag. This should be done on all pages, or at least all the pages where AB Tasty is included on your website

#2.2.2 You are not yet saving the Salesforce Marketing Cloud subscriberKey into the Salesforce B2C Commerce customer profile

In case you are not yet saving the Salesforce Marketing Cloud subscriberKey into the Salesforce B2C Commerce customer profile, then you’ll need to implement this integration yourself. Once done, and so the subscriberKey is saved on the customer profile in Salesforce B2C Commerce, you can refer to the chapter #2.2.1. Please note that the connector’s cartridge is looking for the subscriberKey in the profile’s b2ccrm_contactId custom attribute as this attribute is defined by b2c-crm-sync, recommended in the Salesforce solution kit. If you save it here, then the connector will work right away, if not, then you’ll need to follow the step 4 from the chapter #2.2.1.1 in order to override the configuration of the connector.

Define your own SFMC data Extension 

Because SFMC doesn’t provide some native solution to send our AB Tasty event, you must configure one dedicated Data Extension for the SMFC push integration. 

You must have these following fields : 

  • campaignName (text)
  • variationName (text)
  • variationId (number)
  • SubscriberKey (text as Primary key)
  • campaignId (text as Primary key)
  • Date (date)

You have to reproduce this structure on your side in order to have one dedicated DE where our AB tasty can be exported. Obviously, you must provide us the ID of this DE (see later). 

AB Tasty Configuration: 

  1. Access Integrations > Integration Hub.
  2. Search for and select Salesforce Marketing Cloud (Push section)
  3. Click Setup connector.
  4. Give a name to your connector so you can easily retrieve it.
  5. Enter all the mandatory fields 
  • clientId : refers to the SFMC clientId 
  • clientSecret : refers to your SFMC clientSecret 
  • accountId : refers to your SFMC accountId (called Merchant ID too) 
  • subDomain SFMC : refers to your SFMC subdomain 
  • Data ExtensionId : You must provide the id of the dedicated DE you have already created to store the AB tasty event

Good to Know 💡
The fields: clientId, clientSecret, accountId, subDomain are mandatory in order to establish one token (please refer to this documentation). We must have the right to edit and push some data (not read only).

The Data ExtensionId field is only present to determine on which DE we must push the AB Tasty events (please refer to this documentation).

Check if everything is correct 

To check if the integration between AB Tasty and SFMC is working properly, you can perform the following actions: 

  • Create a campaign 
  • Activate the SFMC push integration inside the advanced option (in the AB tasty dashboard) 
  • Go to your website 
  • Activate the debug mode (copy this command to your console and refresh your browser)

document.cookie="abTastyDebug=true;path=/;";

  • Take an action to become a registered visitor

Once a visitor is identified, you can verify with this command 

window.sfmcconnector.getSfmcSubscriberKey()

> If you have a result, the visitor is well identified and the process could continue

> If you have null as a result, the integration could not continue

1 - If yes, a log should be displayed like that 

2 - You can make another check inside the network tab 

An AB Tasty hit is sent into our integration-api

You can see here that the hit is correctly sent with the payload described in the top of this documentation. 

Heads up ⚡
You must update the AB Tasty tag to make your changes live.

 Good to Know 💡
Please note that the setup of integration in the account settings is not applied retroactively to previously created campaigns. They only apply to newly created campaigns.

Was this article helpful?

/