3rd Party Expense Data

In addition to automatically tracking ROI on ad accounts through the native Facebook and AdWords integrations, SegMetrics allows you to track 3rd Party Expense data. This allows you to track ROI on newsletter campaigns as well as 3rd party advertising systems like Cake and AdRoll.

Expense data can be sent in through the SegMetrics API, either through a standard CURL script, or through a tool like  Zapier.

In order to start using the Expense Data API, you'll need the following information, which you can find in your  Account Settings:

  • SegMetrics API Key
  • SegMetrics Account ID

Set up your API Connection

If you don't have your SegMetrics API Key set, you can set it up by following the instructions below.

  1. Go to your Account Settings, from the gear in the upper-right corner
  2. If you don't have an API Key, click the Refresh button to generate a new API Key
  3. Click "Save Changes"

Configure Expense Tracking Through Zapier

  1. Set up the Trigger to read in your Expense data, either from a 3rd party system, or a file like google SpreadSheets
  2. For the Action, select "Webhooks by Zapier"
  3. Choose "POST" and press continue
  4. Set the URL to be https://api.segmetrics.io/ACCOUNT_ID/direct_marketing/ being sure to replace ACCOUNT_ID with your SegMetrics Account ID.
  5. Under Headers add the following:
    1. KEY: Authorization
    2. VALUE: Basic API_KEY
  6. Be sure to replace API_KEY with your SegMetrics API Key
  7. Make sure Payload Type is set to "Form"
  8. Under DATA add the key "data" (without the parenthesis) and the value should be set to the data you're passing in (see "Data Format" below)
  9. Click Continue

Configure Expense Tracking Manually

SegMetrics Expense Tracking can also be configured manually. The idea is the same as above, but instead of using Zapier, you'll make a CURL request to the SegMetrics API.


curl -X POST \
   https://api.segmetrics.io/ACCOUNT_ID/direct_marketing/ \
   -H 'Authorization: Basic API_KEY ' \
   -F 'data=[{"utm_source": "adroll", "spend": 1234.75, "date_created": "2018-04-04"},{"utm_source": "adroll", "spend": 5678, "date_created": "2018-04-05"}]'
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.segmetrics.io/ACCOUNT_ID/direct_marketing/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_HTTPHEADER, [
	"Authorization: Basic API_KEY "

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
curl_close ($ch);
var request = require('request');

var options = {
    url: 'https://api.segmetrics.io/ACCOUNT_ID/direct_marketing/',
    method: 'POST',
    headers: {
		'Authorization': 'Basic API_KEY'

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {

request(options, callback);

Data Format

The Data is an array of JSON strings that contain:
  • date_created - the date of the spend in Y-m-d format
  • spend - amount in decimal
  • clicks (optional) - the number of clicks for the date as an integer
  • impressions (optional) - the number of impressions for the date as an integer
  • utm_campaign (optional) - the campaign to attribute the spend to
  • utm_source (optional) - the source to attribute the spend to
  • utm_medium (optional) - the medium to attribute the spend to
  • utm_content (optional) - the content to attribute the spend to
  • utm_term (optional) - the term to attribute the spend to
You must include at least one UTM value, but can include as many as you like for more fidelity.
The UTM values will be connected to the UTM click and optin data for your account to determine the number of leads that each campaign provides.

Still need help? Contact Us Contact Us