Integrations

Connect Leadhub

Email and SMS marketing — connect it to Margly with an API token. See how many orders and how much revenue your campaigns brought, and what's left after product costs.

7 min read

What Margly shows from Leadhub#

Leadhub is an email and SMS marketing platform. Margly reads its performance, not its content:

  • Revenue your email marketing brought in — and above all how much of it is left after product costs. That's a number you won't see in Leadhub, because Leadhub doesn't know your purchase prices.
  • Email's share of your whole shop's revenue
  • The path from email to order — sent → delivered → opened → clicked → orders
  • Deliverability — undelivered emails, unsubscribes and spam complaints against the limits mailbox providers tolerate
  • Performance of individual campaigns, automations and popups, including how much a single sent email earns
  • Automations compared with one-off campaigns — per email, automations usually earn far more, and Margly tells you how many times more

How to connect#

Leadhub doesn't use OAuth, and you won't find the API token in the admin — their support issues it on request. Margly therefore prepares the request text for you; you just send it.

  1. Open the Leadhub card in Margly

    Go to Settings → Integrations and open the Leadhub tile. Under "How to get an API token" you'll find the prepared email text and a button to copy it.

  2. Send the request to Leadhub support

    Send the text to podpora@leadhub.co. The request has to be sent by the account owner and must list the endpoints we'll use — the prepared text covers that.

    Margly asks for three read permissions only: campaigns:read (campaigns and their statistics), jobs:read (downloading long exports) and orders:read (orders the campaigns were credited with). We deliberately do not ask for access to subscribers, their emails or phone numbers, nor for any right to write.

  3. Paste the token into Margly

    When the token arrives by email, paste it into the API token field and click Connect. Margly verifies each permission separately — if one is missing, it tells you which, so you know what to ask Leadhub to add.

  4. Margly starts downloading the history

    The first sync fetches the most recent campaigns and fills in older history in the background — month by month, up to five years back. Numbers for longer periods will therefore keep growing for the first few hours. You don't need to click anything or refresh the page; Margly keeps pulling every 15 minutes until it's done.

Where to find the data#

Once connected it appears under Advertising → Leadhub. The section follows the order an email specialist reads numbers in: first what it earned, then the path from email to order, deliverability, one-off campaigns, SMS, automations and popups.

Leadhub also feeds into:

  • The AI Advisor — email marketing enters the analyses
  • The data chat — ask something like "how much did email marketing earn me last month"
  • The Growth plan on the Overview — Margly warns you when deliverability approaches the point where mailbox providers start dropping your emails

How Margly calculates email revenue#

This is the most important thing to understand — and Margly does it differently from Leadhub itself.

Leadhub credits an order to the campaign the customer opened within 24 hours before the purchase, or clicked within 7 days before it (for SMS, delivery counts instead of an open). This window is fixed at Leadhub and can't be changed.

Margly doesn't turn that into a sum, though. The same order can be credited to several campaigns at once — a customer usually receives more emails than they place orders. The headline number is therefore calculated from your orders: each one counted exactly once, even if Leadhub credited it to three campaigns.

Cancellations and returns follow your shop, not Leadhub. An order you cancelled disappears from the revenue even if Leadhub keeps counting it.

Until the recalculation from orders finishes, we show the numbers straight from Leadhub and label them preliminary — after recalculation older campaigns usually go down, because Leadhub still counts orders somebody has cancelled since.

Before revenue appears: the VAT check#

Leadhub itself doesn't know whether it sends order amounts with or without VAT — it depends on your shop's settings. So Margly measures it: it compares a sample of Leadhub orders against the same orders in your data and decides based on the match.

Until it's certain, it doesn't show revenue at all and tells you it's still verifying. That's deliberate — an empty section is better than a number in the wrong tax base. The first sync usually settles it.

Profit from email marketing#

Alongside revenue, Margly shows profit after product costs — calculated from your own data, not from an estimate. You'll therefore only see it when you have purchase prices for enough of the items sold; otherwise we tell you how many items are missing a price, so you know what to fill in under Products.

Profit is calculated for periods up to 13 months. For a longer selection we don't show it.

What to watch out for#

SMS are counted separately. Leadhub also sends SMS through the same campaigns. By their nature they have no opens and no spam complaints, so they would drag down your email open rate — Margly therefore keeps them in a separate block. The revenue they bring is counted normally. So don't add email and SMS together: some orders came after both, and the headline number counts each one once.

Popups don't send anything. For those we measure how many people saw them and how many contacts they gained. Leadhub doesn't track deliveries, orders or revenue for popups, so you won't find those columns in their table.

Automations are measured per period. For continuously running campaigns Leadhub respects the date filter, so you see numbers for the selected period. For one-off sends it ignores the date filter — their statistics always cover the whole campaign and are filed under the send date.

Leadhub reports no spend. Its price is a flat monthly fee for your plan, so it doesn't enter your costs or margins. If you want to account for it, add it as a manual monthly cost under Costs.

The connection has its own measurement history. For older periods the profit from email marketing is filled in gradually — Margly notes next to the number since when it's measured.

What Margly does NOT read from Leadhub#

Margly never reads your subscribers. From the orders Leadhub returns we discard the customer details during processing — not a single email address or phone number reaches our database. We don't even ask for the permission that would let us read them.

Margly also never creates, edits or sends your campaigns, automations or popups. The connection is read-only.

Common errors#

  • "The token doesn't work" — check that you pasted it whole, including the end. Tokens are long and easily truncated when copied out of an email.
  • "The token is missing permissions" — the token works but doesn't have all three required rights. Margly lists the missing ones — send them to Leadhub to be added.
  • "This token is already used by another Margly account" — one token can't belong to two accounts, otherwise data from two shops would mix. Disconnect it from the old account first.
  • "The last sync didn't finish" — the connection is fine and the token is valid, we just couldn't fetch everything. Leadhub has strict request limits (one per minute for the order export), so the sync is deliberately slow. Try Sync now, or wait for the next automatic sync.
  • The section is empty even after connecting — either the first download is still running, or we're waiting for the VAT check (see above). Margly says which on the card.

Disconnecting#

Go to Settings → Integrations → Leadhub and click Disconnect. Margly deletes all data fetched from Leadhub. Your Leadhub account, campaigns and subscribers are unaffected.

What next#

Was this helpful?

Related articles

A human reply

Didn't find your answer?

Write to us directly — we usually reply within 24 hours on business days.

support@margly.io