---
title: "Enriching Purchase Events With Profit Data Using Webhooks"
description: "You can enrich data in Tracklution by utilising our webhook feature and sending the data fully server side to Tracklution. Video walkthrough In the video below, we explain how profit tracking works and why profit should be sent securely from your backend instead of exposing it on your website. We also show step by step how to send profit data to Tracklution, create a new event for ProfitPurchase, and forward it to your ad platforms for profit based optimization. alt text{heig…"
slug: "enriching-purchase-events-with-profit-data-using-webhooks"
category_slug: "data-sources"
category_name: "Data Sources"
order: 4000000016
published_at: "2025-08-12T07:46:47+00:00"
updated_at: "2026-05-14T06:35:01+00:00"
language_code: "en-US"
tags: []
---

You can enrich data in Tracklution by utilising our webhook feature and sending the data fully server-side to Tracklution.

## Video walkthrough

In the video below, we explain how profit tracking works and why profit should be sent securely from your backend instead of exposing it on your website. We also show step by step how to send profit data to Tracklution, create a new event for ProfitPurchase, and forward it to your ad platforms for profit based optimization.

![alt text](video:https://www.youtube.com/watch?v=lBiGNWhhrOk?si=nNECK6ndRVzacq2v){height=315 width=560}

## Profit Tracking With Webhooks

Tracklution webhooks allow you to securely enrich website conversion data with backend data such as profit margins, offline purchases, CRM updates, or ERP data. A common use case is profit tracking. Instead of optimizing campaigns based on revenue, you can optimize based on actual profit. Since profit data is sensitive business information, it should never be exposed in the browser or website data layer. With Tracklution, profit data can be sent securely server-side with a webhook and matched to the original website session automatically.

## How to do Profit Tracking with Tracklution

### Step 1: Track Website Sessions Normally

- Install Tracklution website tracking normally and make sure you send:
    - PageViews
    - ContactInfo (ContactInfo is important because it allows Tracklution to match backend webhook data to the correct website session.) Example:
        - <script>
                    tlq('set', 'ContactInfo', {
                        email: 'customer@email.com',
                        externalId: 'IDABC12345'
                    });
                </script
        - The externalId can be: Order ID, CRM ID,  Customer ID, or any unique identifier available both on the website and in your backend system
    - (Optional) You can also track the Purchase-event on the website, if your Purchases are happening on the website

### Step 2: Send Profit Data With a Webhook

- When the purchase is completed in your backend system, send the purchase data needed to calculate the profit to Tracklution with a webhook. This can be done from:
    - ERP systems
    - CRM systems
    - Shopify
    - WooCommerce
    - Zapier
    - Make.com
    - Custom backend systems
    - Example webhook payload:
        - {
                  "track": "Purchase",
                  "email": "customer@email.com",
                  "value": 980,
                  "currency": "USD",
                  "cost_of_goods": 500,
                  "shipping": 180
    - Important: Always include a matching identifier like email or externalId, and currency when sending values
    - Tracklution automatically matches the webhook event to the original website session if matching data is available.

### Step 3: Create a ProfitPurchase Event with Event Creation Rules

![profitrule](https://support.tracklution.com/kb/agent/attachment/article/16/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjE5OCIsIm9yZ2lkIjoiMTQ3NzgiLCJpc3MiOiJzdXBwb3J0LnRyYWNrbHV0aW9uLmNvbSJ9.QB7xV7TzUi6MPyEMPSPZ8bpsY7Egxupr0jIinQKnvOE)

- In your Tracklution container, go to: Settings → Event Creation Rules → Create Rule
- Configure the rule:
    - Source event: Purchase
    - New event name: ProfitPurchase
    - Create a value field mapping using a formula like: value - webhook.cost\_of\_goods - webhook.shipping
        - This automatically creates a ProfitPurchase event with the calculated profit value.
    - You can choose to:
        - Keep the original Purchase event
        - Create the ProfitPurchase event alongside it

### Step 4: Send ProfitPurchase Events to Ad Platforms

- Once the ProfitPurchase event is created, it can be forwarded to your Connectors.
- Ad platforms can then optimize campaigns using real profit data instead of revenue.

For more information:

[Send Events From Any Platform With a Webhook](https://support.tracklution.com/kb/article/15/send-events-from-any-platform-with-a-webhook)
