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.
Create a new Data Extension
Navigate to Email Studio or Contact Builder.
From the menu, click Subscribers → Data Extensions.
Click Create.
Select Standard Data Extension and click OK.
For Creation Method, choose Create from new, then click Next.
Enter the following configuration:
Name: Flip.to Data Extension
External Key:
flipto-data-extensionDescription: Data extension to pass performance and list data to Flip.to.
Click Next.
Set Data Retention to On. Set Delete to Individual Records and Period to 90 days.
Click Next.
Add the following required fields:
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
Click Create.
Create a SQL Query Activity
Go to Journey Builder → Automation Studio.
Click the Activities tab, then Create Activity.
Select SQL Query and click Next.
Enter the following properties:
Name: Flip.to Email Performance Data
External Key:
flipto-email-performance-dataDescription: Extracts email performance data for Flip.to.
Folder Location: Create or select the Flipto folder.
Click Next.
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.OYBAccountIDClick Validate Syntax to confirm the query is valid, then click Next.
Choose the Flip.to Data Extension you created in the previous step as the target.
Under Data Action, select Update.
Click Next, then Finish.
Schedule the query to run daily
Navigate to Automation Studio → Overview.
Click New Automation.
Drag Schedule into the workflow as the starting source.
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
Click Done.
Drag the SQL Query activity into the first step of the workflow.
Click Choose and select the Flip.to Email Performance Data query you created in the previous step.
Click Done.
Enter the following details:
Name: Flipto Daily Email Performance Data Query Schedule
External Key:
flipto-daily-tracking-data-query-scheduleLocation: Flipto folder
Click Save, then Activate (this opens a dialog to allow to activate) then Activate to begin the daily runs.
Grant API access
Flip.to needs API credentials to synchronize your data automatically.
Click your name in the top-right corner and select Setup.
In the left-side navigation, go to Platform Tools → Apps and select Installed Packages.
Click New and set the package details:
Name: Flip.to Data Integration
Description: This is required for passing data to Flip.to.
Click Save.
Click Add Component, select API Integration, then click Next.
Select Server-to-Server and click Next.
Enable the following permissions:
Channels
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
Click Save.
Copy the Client Secret and store it somewhere safe.
Click Finish, then copy the Client ID.
Open the Access tab in the top-left of the Component view.
Click Enable all business units, then Enable all.
Note your Subdomain — the 28-character string starting with
mcin your base URIs. For example, inmc563885gzs27c5t9-63k636ttgm.rest.marketingcloudapis.com, the subdomain ismc563885gzs27c5t9-63k636ttgm.Note your Parent Business Unit ID (MID) next to your account name in the top right.
Activate in Flip.to
Sign into your Flip.to account and navigate to Platform → Mission Control or Account Settings → Integrations.
Click on Salesforce Marketing Cloud in the Email Marketing section.
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