Snapshots
This topic will walkthrough how to leverage Snapshots in your campaign segmentation.
In this topic:
Overview
Snapshots enable you to take a data point or "snapshot" of a campaign, so you can use this data to make marketing decisions later. You can use snapshot data to query past campaigns to make decisions for future campaigns, or use the snapshot data to create new segments.
To use snapshots at a high level:
-
Create or update a campaign job using the API endpoints, enabling the
enableSnapshots
parameter. -
Run the campaign job. A Datawarehouse data object is created and given the ID "snapshots_<campaignJobID>".
-
Use the saved snapshot data to filter your marketing activities for various use cases.
Use Cases
Here are some of the use cases where you may want to enable Snapshots:
-
Create segments to exclude profiles targeted in previous campaigns.
-
Create segments to exclude profiles targeted in the past (x) days.
-
Create segments to include profiles targeted in previous campaigns, who have not yet taken action.
-
Create segments to exclude profiles that meet specific personalization criteria.
Creating Snapshots
To create a snapshot, use the API to create or update a campaign job that exports the query results on a campaign. In this request body, you must set enableSnapshots
to true
.
POST or PUT https://{AccountURL}/api/cx-unity-api/jobs
{
"tenantId": "mcpsTenantID",
"name": "ResponsysCampaignExportSink",
"jobId": "ResponsysCampaignExportSink",
...
"jobData": {
"ctype": ".CampaignJobData",
...
"mcpsQueryId": "Responsys3",
"ttlInSeconds": 36000000,
"campaignId": "Responsys3ExportSink",
"enableSnapshots" : true,
"updateTable" : "Event",
"queryResultMappings": [
{
"source": "sourceQueryColumn1",
"destination": "destinationTableColumn1"
},
{
"source": "sourceQueryColumn2",
"destination": "destinationTableColumn2"
}
]
}
}
Using Snapshot Data
Snapshot data enables various use cases. To enable these use cases, the following endpoints enable you to manage snapshot data.
Retrieve a list of all snapshots
GET https://{AccountURL}/api-metadata/v1/{tenantAccessKey}/metadata/snapshots
Retrieve a snapshot
GET https://{AccountURL}/api-metadata/v1/{tenantAccessKey}/metadata/snapshots/{snapshotId}
Delete a snapshot
DELETE https://{AccountURL}/api-metadata/v1/{tenantAccessKey}/metadata/snapshots/{snapshotId}
Retrieve a list of partitions for a snapshot
GET https://{AccountURL}/api-data/v1/{tenantAccessKey}/data/snapshots/{snapshotId}/partitions
Retrieve a snapshot's most recent partition
GET https://{AccountURL}/api-data/v1/{tenantAccessKey}/data/snapshots/{snapshotId}/last
Delete a snapshot partition
DELETE https://{AccountURL}/api-data/v1/{tenantAccessKey}/data/snapshots/{snapshotId}/partitions/{partitionId}
Snapshot Considerations
Note the following when leveraging this feature:
- Publish is required only for the first time when you add the enableSnaphots parameter. Subsequent changes to the job configuration (such as enable/disable, mapping) does not require publishes. For example, if you change the snapshot behavior by enabling or disabling the enableSnapshots parameter, a republish is not required.
-
The "enableSnapshot" and "updateTable" parameters are specific to a CAMPAIGN job metadata object. Don't add them to other kinds of jobs, or you will get an error, saying that the "enableSnapshots" property is not recognized.
-
The 'queryResultMappings' section defines mapping from queryResult to the DW table mentioned in the 'updateTable' setting. The source refers to a column in the table where the query results are persisted, and destination is a column name in the nominated DW table for storing export run results for later updates. If this mapping is present, then events are created from the newly generated snapshot and injected into Unity during the campaign run.
-
When activation snapshot is not created, due to either campaign job failure or campaign job successful but not configured correctly, then an error occurs.
-
When mapping with DW table fails, either due to incorrect mapping or campaign job failure or campaign job successful but not configured correctly, then an error occurs, saying that the queryResultMappings must have source and destination tags. Unity validates that each source has a destination.
-
The data in the snapshots tables are available for query, and survives until purged by GDPR or expiry process purging.
-
You don't have to use the enableSnapshots parameter to capture data from Campaign job runs. The updateTable and queryResultsMappings parameters allow you to write campaign job data back into the Event table. For example, a Campaign job run can be configured to the job run timestamp back into the Event table. You can then use the job run timestamp as a criteria for future job runs.