Skip to main content

Tracking Extract with Custom Date Range

When working with Tracking Extracts in Salesforce Marketing Cloud, the UI limits you to a 90-day period for data extraction. However, by leveraging the API, you can bypass this limitation and retrieve data from your account's inception date.

Salesforce Official Docs: Tracking Extract

Use Cases

A key use case is retrieving all email sends from a specific Business Unit since account creation. This is useful for "mapping contacts to a Business Unit" by using email send history as a proxy, since contacts can't be directly mapped to Business Units.

Parameters

When setting up your API call, make sure to update the following parameters:

  • Subdomain: Your Salesforce Marketing Cloud subdomain.
  • Access Token: Your authentication token for the API.
  • Output File Name: Define the name of your output file.
  • Notification Email: Provide an email address to receive notifications.
  • Start Date: The beginning of the date range for data extraction.
  • End Date: The end of the date range for data extraction.
  • AccountIDs: Specifies the Business Unit (BU) you want to extract data for:
    • Leave blank to extract information from the BU where you got the authentication token from.
    • Use an asterisk * to extract information from all accounts and subaccounts in an Enterprise account (requires execution on the parent BU).
    • Provide a comma-delimited list of account ID numbers to extract information from specific accounts inside an Enterprise account.

This Stack Exchange post provides additional information on interpreting Tracking Extract parameters, as the official Salesforce documentation is incomplete.

Interactive Example

Use the interactive example below to generate the API request details:

Endpoint
https://your_subdomain.soap.marketingcloudapis.com/Service.asmx
Method
POST
Request Body
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">Retrieve</a:Action>
<a:To s:mustUnderstand="1">https://your_subdomain.soap.marketingcloudapis.com/Service.asmx</a:To>
<fueloauth xmlns="http://exacttarget.com">your_access_token</fueloauth>
</s:Header>
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ExtractRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Requests>
<ID>ae20972d-92e3-4c7f-87ec-e342ac60d3c8</ID>
<Parameters>
<Parameter>
<Name>OutputFileName</Name>
<Value>extractname.zip</Value>
</Parameter>
<Parameter>
<Name>NotificationEmail</Name>
<Value>your_email@example.com</Value>
</Parameter>
<Parameter>
<Name>StartDate</Name>
<Value>2020-01-01T00:00:00</Value>
</Parameter>
<Parameter>
<Name>EndDate</Name>
<Value>2023-12-31T23:59:59</Value>
</Parameter>
<Parameter>
<Name>AccountIDs</Name>
<Value>*</Value>
</Parameter>
</Parameters>
</Requests>
</ExtractRequestMsg>
</s:Body>
</s:Envelope>