For the complete documentation index, see llms.txt. This page is also available as Markdown.

Salesforce Marketing Cloud

With our Salesforce Marketing Cloud integration, you'll be able to track audience behavior and contribution value of your email marketing with Spacetime.

This guide walks through the setup in Salesforce Marketing Cloud (SFMC) that enables automated performance tracking and data synchronization with Spacetime.

Before you start, make sure the Parent Business Unit is selected in the top right of your SFMC dashboard. If another unit is shown, click View Hierarchy and select the Parent Business Unit.

1

Create a new Data Extension

  1. Navigate to Email Studio or Contact Builder.

  2. From the menu, click SubscribersData Extensions.

  3. Click Create.

  4. Select Standard Data Extension and click OK.

  5. For Creation Method, choose Create from new, then click Next.

  6. Enter the following configuration:

    • Name: Flip.to Data Extension

    • External Key: flipto-data-extension

    • Description: Data extension to pass performance and list data to Flip.to.

  7. Click Next.

  8. Set Data Retention to On. Set Delete to Individual Records and Period to 90 days.

  9. Click Next.

  10. Add the following required fields:

Field Name
Data Type
Length
Primary Key
Nullable

JobID

Number

Yes

No

BatchID

Number

Yes

No

SubscriberID

Number

Yes

No

ActionDate

Date

Yes

No

ActionType

Text

50

Yes

No

EmailAddress

EmailAddress

254

No

Yes

EmailID

Number

No

Yes

TriggererSendDefinitionObjectID

Text

50

No

Yes

TriggeredSendCustomerKey

Text

50

No

Yes

AccountID

Number

No

No

OYBAccountID

Number

No

Yes

  1. Click Create.

2

Create a SQL Query Activity

  1. Go to Journey BuilderAutomation Studio.

  2. Click the Activities tab, then Create Activity.

  3. Select SQL Query and click Next.

  4. Enter the following properties:

    • Name: Flip.to Email Performance Data

    • External Key: flipto-email-performance-data

    • Description: Extracts email performance data for Flip.to.

    • Folder Location: Create or select the Flipto folder.

  5. Click Next.

  6. Paste the following query into the editor:

SELECT
    JobID = _Sent.JobId,
    BatchID = _Sent.BatchID,
    SubscriberID = _Sent.SubscriberID,
    ActionDate = CAST(_Sent.EventDate AS DATE),
    ActionType = 'send',
    EmailID = _Job.EmailID,
    EmailAddress = _Subscribers.EmailAddress,
    TriggeredSendCustomerKey = _Sent.TriggeredSendCustomerKey,
    TriggererSendDefinitionObjectID = _Sent.TriggererSendDefinitionObjectID,
    AccountID = _Sent.AccountID,
    OYBAccountID = _Sent.OYBAccountID
FROM _Sent
JOIN _Subscribers ON _Sent.SubscriberId = _Subscribers.SubscriberId
LEFT JOIN _Job ON _Sent.JobID = _Job.JobID
CROSS JOIN (
  SELECT
    DATEADD(m,-1,DATEDIFF(d,0,GETDATE())) AS RangeStart,
    DATEADD(d, 0,DATEDIFF(d,0,GETDATE())) AS RangeEnd
) d
WHERE _Sent.EventDate >= d.RangeStart AND _Sent.EventDate < d.RangeEnd
GROUP BY _Sent.JobId, _Sent.BatchID, _Sent.SubscriberID, CAST(_Sent.EventDate AS DATE), _Job.EmailID,
    _Subscribers.EmailAddress, _Sent.TriggeredSendCustomerKey, _Sent.TriggererSendDefinitionObjectID,
    _Sent.AccountID, _Sent.OYBAccountID

UNION ALL

SELECT
    JobID = _Open.JobId,
    BatchID = _Open.BatchID,
    SubscriberID = _Open.SubscriberID,
    ActionDate = CAST(_Open.EventDate AS DATE),
    ActionType = 'open',
    EmailID = _Job.EmailID,
    EmailAddress = _Subscribers.EmailAddress,
    TriggeredSendCustomerKey = _Open.TriggeredSendCustomerKey,
    TriggererSendDefinitionObjectID = _Open.TriggererSendDefinitionObjectID,
    AccountID = _Open.AccountID,
    OYBAccountID = _Open.OYBAccountID
FROM _Open
JOIN _Subscribers ON _Open.SubscriberId = _Subscribers.SubscriberId
LEFT JOIN _Job ON _Open.JobID = _Job.JobID
CROSS JOIN (
  SELECT
    DATEADD(m,-1,DATEDIFF(d,0,GETDATE())) AS RangeStart,
    DATEADD(d, 0,DATEDIFF(d,0,GETDATE())) AS RangeEnd
) d
WHERE _Open.EventDate >= d.RangeStart AND _Open.EventDate < d.RangeEnd
GROUP BY _Open.JobId, _Open.BatchID, _Open.SubscriberID, CAST(_Open.EventDate AS DATE), _Job.EmailID,
    _Subscribers.EmailAddress, _Open.TriggeredSendCustomerKey, _Open.TriggererSendDefinitionObjectID,
    _Open.AccountID, _Open.OYBAccountID

UNION ALL

SELECT
    JobID = _Click.JobId,
    BatchID = _Click.BatchID,
    SubscriberID = _Click.SubscriberID,
    ActionDate = CAST(_Click.EventDate AS DATE),
    ActionType = 'click',
    EmailID = _Job.EmailID,
    EmailAddress = _Subscribers.EmailAddress,
    TriggeredSendCustomerKey = _Click.TriggeredSendCustomerKey,
    TriggererSendDefinitionObjectID = _Click.TriggererSendDefinitionObjectID,
    AccountID = _Click.AccountID,
    OYBAccountID = _Click.OYBAccountID
FROM _Click
JOIN _Subscribers ON _Click.SubscriberId = _Subscribers.SubscriberId
LEFT JOIN _Job ON _Click.JobID = _Job.JobID
CROSS JOIN (
  SELECT
    DATEADD(m,-1,DATEDIFF(d,0,GETDATE())) AS RangeStart,
    DATEADD(d, 0,DATEDIFF(d,0,GETDATE())) AS RangeEnd
) d
WHERE _Click.EventDate >= d.RangeStart AND _Click.EventDate < d.RangeEnd
GROUP BY _Click.JobId, _Click.BatchID, _Click.SubscriberID, CAST(_Click.EventDate AS DATE), _Job.EmailID,
    _Subscribers.EmailAddress, _Click.TriggeredSendCustomerKey, _Click.TriggererSendDefinitionObjectID,
    _Click.AccountID, _Click.OYBAccountID

UNION ALL

SELECT
    JobID = _Bounce.JobId,
    BatchID = _Bounce.BatchID,
    SubscriberID = _Bounce.SubscriberID,
    ActionDate = CAST(_Bounce.EventDate AS DATE),
    ActionType = 'bounce',
    EmailID = _Job.EmailID,
    EmailAddress = _Subscribers.EmailAddress,
    TriggeredSendCustomerKey = _Bounce.TriggeredSendCustomerKey,
    TriggererSendDefinitionObjectID = _Bounce.TriggererSendDefinitionObjectID,
    AccountID = _Bounce.AccountID,
    OYBAccountID = _Bounce.OYBAccountID
FROM _Bounce
JOIN _Subscribers ON _Bounce.SubscriberId = _Subscribers.SubscriberId
LEFT JOIN _Job ON _Bounce.JobID = _Job.JobID
CROSS JOIN (
  SELECT
    DATEADD(m,-1,DATEDIFF(d,0,GETDATE())) AS RangeStart,
    DATEADD(d, 0,DATEDIFF(d,0,GETDATE())) AS RangeEnd
) d
WHERE _Bounce.EventDate >= d.RangeStart AND _Bounce.EventDate < d.RangeEnd
GROUP BY _Bounce.JobId, _Bounce.BatchID, _Bounce.SubscriberID, CAST(_Bounce.EventDate AS DATE), _Job.EmailID,
    _Subscribers.EmailAddress, _Bounce.TriggeredSendCustomerKey, _Bounce.TriggererSendDefinitionObjectID,
    _Bounce.AccountID, _Bounce.OYBAccountID

UNION ALL

SELECT
    JobID = _Unsubscribe.JobId,
    BatchID = _Unsubscribe.BatchID,
    SubscriberID = _Unsubscribe.SubscriberID,
    ActionDate = CAST(_Unsubscribe.EventDate AS DATE),
    ActionType = 'unsubscribe',
    EmailID = _Job.EmailID,
    EmailAddress = _Subscribers.EmailAddress,
    TriggeredSendCustomerKey = null,
    TriggererSendDefinitionObjectID = null,
    AccountID = _Unsubscribe.AccountID,
    OYBAccountID = _Unsubscribe.OYBAccountID
FROM _Unsubscribe
JOIN _Subscribers ON _Unsubscribe.SubscriberId = _Subscribers.SubscriberId
LEFT JOIN _Job ON _Unsubscribe.JobID = _Job.JobID
CROSS JOIN (
  SELECT
    DATEADD(m,-1,DATEDIFF(d,0,GETDATE())) AS RangeStart,
    DATEADD(d, 0,DATEDIFF(d,0,GETDATE())) AS RangeEnd
) d
WHERE _Unsubscribe.EventDate >= d.RangeStart AND _Unsubscribe.EventDate < d.RangeEnd
GROUP BY _Unsubscribe.JobId, _Unsubscribe.BatchID, _Unsubscribe.SubscriberID, CAST(_Unsubscribe.EventDate AS DATE), _Job.EmailID,
    _Subscribers.EmailAddress, _Unsubscribe.AccountID, _Unsubscribe.OYBAccountID
  1. Click Validate Syntax to confirm the query is valid, then click Next.

  2. Choose the Flip.to Data Extension you created in the previous step as the target.

  3. Under Data Action, select Update.

  4. Click Next, then Finish.

3

Schedule the query to run daily

  1. Navigate to Automation StudioOverview.

  2. Click New Automation.

  3. Drag Schedule into the workflow as the starting source.

  4. Click Configure and set the following:

    • Start Date: Tomorrow's date

    • Start Time: As early in the morning as possible, ideally before 7am EST

    • Time Zone: Your local time zone

    • Repeat: Daily, every 1 day

    • End: Never

  5. Click Done.

  6. Drag the SQL Query activity into the first step of the workflow.

  7. Click Choose and select the Flip.to Email Performance Data query you created in the previous step.

  8. Click Done.

  9. Enter the following details:

    • Name: Flipto Daily Email Performance Data Query Schedule

    • External Key: flipto-daily-tracking-data-query-schedule

    • Location: Flipto folder

  10. Click Save, then Activate (this opens a dialog to allow to activate) then Activate to begin the daily runs.

4

Grant API access

Flip.to needs API credentials to synchronize your data automatically.

  1. Click your name in the top-right corner and select Setup.

  2. In the left-side navigation, go to Platform ToolsApps and select Installed Packages.

  3. Click New and set the package details:

    • Name: Flip.to Data Integration

    • Description: This is required for passing data to Flip.to.

  4. Click Save.

  5. Click Add Component, select API Integration, then click Next.

  6. Select Server-to-Server and click Next.

  7. Enable the following permissions:

Category
Collection
Permission

Channels

Email

Read

Assets

Documents and Images

Read

Automation

Journeys

Read

Contacts

Audiences

Read

Contacts

Lists and Subscribers

Read

Data

Data extensions

Read, Write

Data

Tracking events

Read

Hub

Campaigns

Read

Provisioning

Accounts

Read

  1. Click Save.

  2. Copy the Client Secret and store it somewhere safe.

  1. Click Finish, then copy the Client ID.

  2. Open the Access tab in the top-left of the Component view.

  3. Click Enable all business units, then Enable all.

  4. Note your Subdomain — the 28-character string starting with mc in your base URIs. For example, in mc563885gzs27c5t9-63k636ttgm.rest.marketingcloudapis.com, the subdomain is mc563885gzs27c5t9-63k636ttgm.

  5. Note your Parent Business Unit ID (MID) next to your account name in the top right.

5

Activate in Flip.to

  1. Sign into your Flip.to account and navigate to Platform → Mission Control or Account Settings → Integrations.

  2. Click on Salesforce Marketing Cloud in the Email Marketing section.

  3. Add the Client ID, Client Secret, and Subdomain you copied earlier.

Switch on and that's it. Salesforce Marketing Cloud is now connected and data should start flowing into your Flip.to platform.

Last updated