# Real Profit Dashboard — Complete guide

> Real Profit Dashboard computes your WooCommerce store's real profitability, order by order. This guide covers installation, cost setup (COGS, payment fees, shipping), wiring up the three ad integrations (Meta, Google,…

- Page: <https://www.datafirefly.com/en/documentation/real-profit-dashboard/>
- Language: en
- Last updated: 2026-07-01
- Other languages: [fr](https://www.datafirefly.com/documentation/real-profit-dashboard/index.md), [es](https://www.datafirefly.com/es/documentation/real-profit-dashboard/index.md), [de](https://www.datafirefly.com/de/documentation/real-profit-dashboard/index.md), [it](https://www.datafirefly.com/it/documentation/real-profit-dashboard/index.md), [pl](https://www.datafirefly.com/pl/documentation/real-profit-dashboard/index.md), [nl](https://www.datafirefly.com/nl/documentation/real-profit-dashboard/index.md), [pt](https://www.datafirefly.com/pt/documentation/real-profit-dashboard/index.md)
- Index: <https://www.datafirefly.com/en/documentation/llms.txt>

Real Profit Dashboard computes your WooCommerce store's real profitability, order by order. This guide covers installation, cost setup (COGS, payment fees, shipping), wiring up the three ad integrations (Meta, Google, TikTok), dashboard usage and ongoing maintenance.

## Requirements

- WordPress 6.2 or newer
- WooCommerce 8.0 or newer (HPOS and Cart & Checkout Blocks compatible)
- PHP 8.0 or newer
- Administrator access to the WordPress back-office
- API credentials for Meta Ads, Google Ads and/or TikTok Ads if you want to enable automatic ad spend import (optional)

## Installation

1. Go to **Plugins → Add New → Upload Plugin**.
2. Select the `dfrealprofit.zip` file and click **Install Now**.
3. Activate the plugin.
4. A new top-level menu **Profit Dashboard** appears in the sidebar, below WooCommerce.

On activation, the plugin creates three tables (`wp_dfrp_ad_spend`, `wp_dfrp_order_metrics`, `wp_dfrp_sync_log`) and schedules two hourly CRON tasks: ad spend synchronization and a rolling 14-day recalculation.

## Getting started

### Set the purchase cost (COGS) on your products

COGS (Cost of Goods Sold) is the cornerstone of margin calculation. Without it, the displayed profit is overstated.

- **Simple product:** open the product page, **General** tab, fill in the _Purchase cost_ field with the tax-exclusive amount paid to the supplier.
- **Variable product:** each variation has its own _Purchase cost_ field. Filling it variation by variation is essential when costs differ (sizes, colors, materials).
- **Bulk:** the field is also writable via the WooCommerce REST API (`PUT /wp-json/wc/v3/products/{id}`, meta `_dfrp_cogs`), which allows bulk import from an ERP.

A _COGS_ column appears in the product list to quickly identify products that have not yet been set.

### Configure payment fees

Go to **Profit Dashboard → Settings → Payment fees**.

- **Stripe, WooCommerce PayPal Payments, Mollie:** no setup needed. The plugin reads the real fees directly from the order meta (`_stripe_fee`, `_ppcp_paypal_fees`, `_mollie_fee`).
- **Other gateways:** enter the applicable percent + fixed scheme. For a free bank transfer: 0 % / 0 €. For a check with bank charges: 0 % / 0.15 €. These default values are used if no real-fee meta is found on the order.

### Configure shipping costs

Go to **Profit Dashboard → Settings → Default shipping costs**. The table automatically lists every shipping method from your WooCommerce zones.

For each method, enter the average actual cost paid to the carrier (excluding the margin you add for the customer). For example, if you charge 6.90 € for a Colissimo shipment that costs you 4.50 €, enter **4.50**.

These values are defaults. You can always override the real cost order by order (side metabox on the order screen) if a particular shipment cost more or less.

## Ad integrations

Each integration is independent. You can enable one, two, or all three of them. All are configured under **Profit Dashboard → Settings**.

### Meta Ads (Facebook + Instagram)

1. Create an app in [Meta for Developers](https://developers.facebook.com/) or use an existing one.
2. Generate a **long-lived access token** with the `ads_read` scope. Official docs are under _Marketing API → Get Started_.
3. Retrieve your **Ad Account ID** from _Meta Business Manager → Settings → Ad accounts_ (numeric format, without the `act_` prefix).
4. In the plugin settings, tick **Enable Meta Ads**, paste the access token and the Ad Account ID.
5. Save, then click **Sync Ads now** from the dashboard to validate the connection.

### Google Ads

Google Ads uses OAuth 2. You need five credentials.

1. **Developer token:** request it from your Google Ads Manager (MCC) account, under _Tools & Settings → Setup → API Center_.
2. **Customer ID:** the 10-digit ID of the ad account you want to track (without dashes).
3. **OAuth client ID** and **client secret:** create a project in [Google Cloud Console](https://console.cloud.google.com/), enable the Google Ads API, create a _Desktop application_ OAuth 2 client.
4. **Refresh token:** obtain it once through the OAuth flow (see Google Ads API v18 documentation). It never changes.

The plugin automatically exchanges the refresh token for an access token on every sync, and caches it for its validity period (one hour). Nothing to do once the credentials are set.

### TikTok Ads

1. Create an app in [TikTok Business Developers](https://business-api.tiktok.com/portal/).
2. Authorize it on your ad account to obtain an **access token**.
3. Retrieve the **Advertiser ID** from TikTok Ads Manager (account menu, top right).
4. In the plugin settings, tick **Enable TikTok Ads**, paste the access token and the Advertiser ID.

## Multi-touch attribution

As soon as the plugin is active, two cookies are set on every visitor: `dfrp_ft` (first-touch, the earliest known channel) and `dfrp_lt` (last-touch, the most recent channel). Both last 90 days.

On every visit, the plugin captures the following URL parameters:

- Standard UTMs: `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`
- Click identifiers: `fbclid` (Facebook), `gclid` (Google), `ttclid` (TikTok)

When the order is created, both cookies are frozen into the order meta (`_dfrp_utm_ft`, `_dfrp_utm_lt`). The normalized channel is then derived from the last-touch (with a fallback on first-touch), and placed into one of nine categories: _Facebook, Instagram, Google, TikTok, Email, Organic, Direct, Referral, Other_.

### Ad spend allocation

Two modes are available in the settings:

- **Per order** (default): a channel's total daily spend is divided by the number of orders attributed to that channel that day. Each order receives an equal share.
- **Pro-rated by revenue**: spend is distributed proportionally to each order's share of the channel's daily revenue. A 300 € order receives three times more ad cost than a 100 € order.

## Using the dashboard

The main dashboard is available under **Profit Dashboard → Dashboard**.

### Main KPIs

Seven indicators are displayed at the top of the page, for the selected range:

- **Revenue**: net revenue (excluding taxes per settings, excluding refunds)
- **COGS**: sum of purchase costs on sold line items
- **Payment fees**: total gateway fees
- **Shipping**: total actual shipping costs
- **Advertising**: total allocated ad spend
- **Net profit**: Revenue − COGS − Payment fees − Shipping − Ads − Other costs
- **Margin**: net profit / revenue as a percentage

### Chart and channels

Below the KPIs, a bar chart displays daily profit over the range (green bars for a positive profit, red for a loss).

The **Performance by channel** block aggregates orders per normalized channel with, for each: order count, revenue, ad spend, ROAS (Return On Ad Spend = revenue / ad spend), net profit and margin.

### Filters and date ranges

Seven predefined ranges: Today, 7 days, 30 days, 90 days, Month to date, Year to date, Custom range. Ranges are relative to the current day and update automatically on every page load.

## Order screen metabox

Every order has a **Real Profit Dashboard** metabox in the right sidebar of its edit screen. It displays the detected acquisition channel and provides three manual entry fields that override the computed values:

- **Payment fees (€)**: to force a specific value (for example after a partial refund of fees)
- **Actual shipping cost (€)**: the amount actually paid to the carrier for this specific order
- **Other costs (€)**: free field for any specific cost (customs, special packaging, customer return, etc.)

A summary under the fields shows in real time: net revenue, detailed costs, profit and margin. Every order save triggers an automatic recalculation.

## CRON and synchronization

Two automatic tasks are scheduled:

- **dfrp_cron_sync_ads** (hourly): calls each active integration to retrieve spend over the last 7 days, campaign by campaign, and updates the `wp_dfrp_ad_spend` table.
- **dfrp_cron_recalculate_orders** (hourly, chained): recalculates metrics for orders over the last 14 days to account for newly imported ad spend.

The full log of every run is available under **Profit Dashboard → Sync logs**: status, duration, inserted and updated counts, and error message if any.

If your WordPress runs on shared hosting with an unreliable WP-Cron, we recommend disabling `DISABLE_WP_CRON` and scheduling a real system CRON every hour: `curl -s https://your-domain.com/wp-cron.php > /dev/null`.

## Manual recalculation

The **Recalculate 60 days** button on the dashboard regenerates metrics for every order over the last 60 days. Use it after:

- the initial plugin installation (to bootstrap history)
- a bulk change to product COGS values
- a change to payment fees or shipping cost schemes
- a change to the ad spend allocation mode

The operation is idempotent: running it multiple times yields the same result.

## REST API

Three endpoints are exposed under `/wp-json/dfrealprofit/v1/`. They require the `manage_woocommerce` capability and accept WordPress cookie authentication or Application Password.

- `GET /summary?from=YYYY-MM-DD&to=YYYY-MM-DD` — aggregated KPIs (revenue, COGS, fees, ads, profit, margin)
- `GET /series?from=YYYY-MM-DD&to=YYYY-MM-DD` — daily series (revenue, costs, profit per day)
- `GET /channels?from=YYYY-MM-DD&to=YYYY-MM-DD` — performance by channel (orders, revenue, ads, ROAS, profit, margin)

These endpoints allow you to wire an external dashboard (Looker Studio, Metabase, Grafana, spreadsheet) to the plugin's metrics.

## Uninstallation

Deactivation alone deletes nothing. Full deletion from **Plugins** triggers `uninstall.php`, which:

- drops the three custom tables (`ad_spend`, `order_metrics`, `sync_log`)
- deletes the plugin options
- unschedules the CRON tasks
- **preserves** product COGS values and order meta (valuable business data)

For a full cleanup including meta, uncomment two SQL lines in `uninstall.php` before uninstalling.

## Quick FAQ

### Is the plugin compatible with WooCommerce Subscriptions?

Yes. Every renewal generates a standard order that is processed like any other.

### What happens if I change a product's price?

Nothing for existing orders: historical COGS and price stay frozen at the moment of sale. Only new orders will use the new price.

### How do I handle a refund?

Create a standard refund from WooCommerce. Net revenue is recalculated automatically (the refunded total is deducted). Costs already incurred (COGS, shipping, payment fees, ads) remain, which shows the real loss.

### Can I use the plugin without any Ads integration?

Yes. Without any ad integration, ad costs are zero and the calculation is limited to net revenue − COGS − payment fees − shipping − other costs. It is already vastly better than what WooCommerce shows by default.

### Is data sent to an external server?

No. The only external calls are the ones you configure yourself to the Meta, Google and TikTok APIs, to **fetch** your spend. No data from your store is sent to DataFirefly or any third party.
