Every recipe sends one stage change to POST https://api.geoswap.co/v1/conversions with a key that has the conversions:write scope (Setup → API Keys). Fields are in the API reference. To match conversions to visits, capture the visitor id with hidden form fields (how) and store it on the lead.
Needs: Salesforce Enterprise edition or above (HTTP Callout in Flow), and an admin.
Not yet verified end to end; tell support@geoswap.co if a step differs.
GeoSwap, protocol Custom. Add a principal with a parameter ApiKey = your gs_live_… key, and a custom header Authorization = {!'Bearer ' & $Credential.GeoSwap.ApiKey}.GeoSwap, URL https://api.geoswap.co, external credential GeoSwap, Generate Authorization Header off, Allow Formulas in HTTP Header on.OccurredAtIso (Text): SUBSTITUTE(TEXT({!$Flow.CurrentDateTime}), " ", "T"): Salesforce writes date-times in GMT with a trailing Z.GeoSwap, method POST, URL path /v1/conversions, and paste the sample body below so Salesforce generates the request type. Map the fields as shown.parent_external_id to the Lead Id it was converted from (store it in a custom field such as GeoSwap_Lead_Id__c at conversion). Without one, each stage still counts; it just isn't linked to the lead.""; GeoSwap ignores empty optional fields, so a lead without a visitor id or amount still counts. Keep value in quotes (as below) so a blank Amount stays valid JSON.201 (or 200 on a re-send).{
"event": "qualified",
"external_id": "{!$Record.Id}",
"parent_external_id": "{!$Record.GeoSwap_Lead_Id__c}",
"occurred_at": "{!OccurredAtIso}",
"visitor_id": "{!$Record.GS_Visitor_Id__c}",
"value": "{!$Record.Amount}",
"currency": "USD"
}Needs: HubSpot Data Hub (formerly Operations Hub) Professional or Enterprise for the "Send a webhook" action.
Not yet verified end to end; tell support@geoswap.co if a step differs.
https://api.geoswap.co/v1/conversions.Authorization, value Bearer gs_live_… (the bare key also works), location Request header.event = qualified; external_id = Record ID; occurred_at = Became a Marketing Qualified Lead date (HubSpot sends epoch milliseconds, which GeoSwap accepts); email = Email; visitor_id = the contact property your form saves gs_vid into.hs_object_id) is a number; GeoSwap accepts external_id as either a JSON number or a string, so send it either way.external_id (the Record ID), so GeoSwap links them into one journey automatically.201.Needs: a Zapier plan that includes Webhooks by Zapier (paid plans).
Not yet verified end to end; tell support@geoswap.co if a step differs.
https://api.geoswap.co/v1/conversions, payload type json.event (type the stage name), external_id (the record id), occurred_at (the trigger's date; add a Formatter step to ISO 8601 if it has no time zone), plus email, value, visitor_id if you have them.Authorization = Bearer gs_live_….201 with result: "created".Any language that can make an HTTPS POST. Batch up to 500 per request with POST https://api.geoswap.co/v1/conversions/batch.
GEOSWAP_API_KEY); never ship it to a browser.gs_vid cookie or hidden field, and tags for things like site and market.429 (after Retry-After) and 5xx; re-sending the same event + external_id is safe.// Node 18+ (fetch built in). Send each stage when it happens.
const res = await fetch("https://api.geoswap.co/v1/conversions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.GEOSWAP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"event": "qualified",
"external_id": "006Hs00001AbCdE",
"parent_external_id": "00QHs00002XyZqR",
"occurred_at": "2026-10-12T14:03:00Z",
"visitor_id": "Xb3k9_Qm2LpA7vR1.20261003",
"email": "jane@example.com",
"value": 1200,
"currency": "USD",
"tags": {
"market": "co"
}
}),
});
if (res.status === 429) {
// Rate limited: wait Retry-After seconds, then retry.
} else if (!res.ok) {
const { error } = await res.json(); // { code, message, request_id }
console.error(error.code, error.request_id);
}Needs: a key with the spend:write scope. Up to 5,000 rows per request, all or nothing.
period is the day (YYYY-MM-DD, UTC). GeoSwap stores spend per day.0 to remove it (a row your query no longer returns isn't sent, so it would stay). Re-sending the same body changes nothing. summary.upserted and summary.deleted count the stored days that changed; first_day and last_day bound them.campaign must be the same value your links carry in utm_campaign (case doesn't matter) or spend can't line up with credits. A value with spend that no traffic has used in 120 days comes back as a campaign_not_seen warning; it is still written.409 currency_mismatch. Built-in platforms (meta, google_ads, …) book to their own channel; leave channel out for them.429 or 503, wait the Retry-After seconds plus a little random jitter and re-send the same body. Use dry_run: true to check a body without writing.// Node 18+. Nightly: send the last 14 days (needs spend:write). Spend is stored per day: each day you
// send replaces that day and nothing else, so any window works (yesterday alone is fine). Re-sending the
// last 14 days picks up the ad platforms' late corrections; re-sending the same rows is a no-op.
const days = await warehouse.query(`
SELECT to_char(day, 'YYYY-MM-DD') AS day, -- a 'YYYY-MM-DD' string, not a driver Date (time zones!)
platform, channel, campaign, SUM(cost) AS amount
FROM ad_spend
WHERE day >= current_date - interval '14 days'
GROUP BY 1, 2, 3, 4`);
const body = {
currency: "USD", // the workspace's one spend currency
rows: days.map((d) => ({
period: d.day,
platform: d.platform ?? undefined, // meta, google_ads, …; leave out for custom spend
channel: d.channel ?? undefined, // custom spend needs a channel key (e.g. "podcast"); built-in platforms don't
campaign: d.campaign ?? undefined, // must equal the links' utm_campaign; leave out for channel-level spend
amount: Number(d.amount).toFixed(2),
})),
};
let sent = false;
for (let attempt = 0; attempt < 5 && !sent; attempt++) {
const res = await fetch("https://api.geoswap.co/v1/spend", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.GEOSWAP_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (res.status === 429 || res.status === 503) { // busy: wait Retry-After (+ jitter), re-send the same body
await new Promise((r) => setTimeout(r, (Number(res.headers.get("Retry-After") ?? 2) + Math.random()) * 1000));
continue;
}
const out = await res.json();
if (!res.ok) throw new Error(`${res.status} ${out.error.code}: ${out.error.message}`);
for (const w of out.warnings) console.warn(w.code, w.path, w.message); // e.g. a campaign no link uses
sent = true;
}
if (!sent) throw new Error("GeoSwap was busy for 5 attempts; try again later.");Needs: a key with the attribution:read scope (Setup → API Keys).
GET https://api.geoswap.co/v1/attribution for a report: one event (e.g. purchase), grouped by channel, source, medium, campaign, ad (utm_content), keyword (utm_term; add campaign to keep each per campaign), landing page, referrer site (referrer_site: the site visitors came from), link, country or device (device: desktop, mobile or tablet; null for conversions credited before Nov 7, 2026), with daily numbers. Add host to scope it to one of your sites. Page with next_cursor. Rows grouped by campaign also carry campaign_name, the name you gave the campaign in GeoSwap or its name in a connected ad platform (null when it has none); filter and page by campaign. With group_by=campaign (or channel,campaign) and no host, they also carry ad_platform: the connected Meta and Google Ads campaigns' impressions, clicks, cost, ctr, cpc, cpm, site_sessions (GeoSwap visits, bots excluded), visits_per_click and the campaigns it covers (visits_per_click_campaigns of campaigns_total) over the same days (null with any other grouping, on a non-platform channel, or when nothing is stored). Rows grouped by source likewise carry source_name (e.g. fb, ig and l.facebook.com are all “Meta”; paid google is “Google Ads”, organic is “Google”) and source_platform (meta, google_ads, … or null); filter and page by source. Paid vs organic Google, Bing and YouTube needs channel or medium in group_by too; without them the organic name applies.GET https://api.geoswap.co/v1/conversions?external_id=… to show where one order came from: its touches (each with campaign_name, source_name, source_platform, referrer (the site it came from), utm_content (the ad), utm_term (the keyword), country, state and DMA), the credited touch, every model's split, and the conversion's region (country, state, DMA, postal code and city).POST https://api.geoswap.co/v1/conversions/search with { "email": "…" } in the body (never the URL). You get every conversion sent with that email, grouped by journey (group), each with the same touches and credits as the lookup by id. It needs a key with the attribution:lookup scope.GET https://api.geoswap.co/v1/visitors/{gs_vid} for a visitor's first and last touch, e.g. on an order page. Each touch carries campaign_name, source_name and source_platform too.// Node 18+. Show GeoSwap's attribution in your own app (needs attribution:read).
const base = "https://api.geoswap.co/v1";
const headers = { Authorization: `Bearer ${process.env.GEOSWAP_API_KEY}` };
// 1. Revenue by source and campaign for last month, page by page.
let cursor = null;
do {
const q = new URLSearchParams({ start_date: "2026-10-01", end_date: "2026-10-31", event: "purchase", group_by: "source,campaign", buckets: "none" });
if (cursor) q.set("cursor", cursor);
const res = await fetch(`${base}/attribution?${q}`, { headers });
if (res.status === 429) { /* wait Retry-After seconds, then retry */ break; }
const page = await res.json();
for (const row of page.rows) console.log(row.source, row.campaign, row.conversions, row.value, page.currency);
cursor = page.next_cursor;
} while (cursor);
// 2. Where did order 1001 come from? (the query form takes any id)
const order = await (await fetch(`${base}/conversions?${new URLSearchParams({ external_id: "order-1001" })}`, { headers })).json();
const c = order.conversions[0];
const credited = c.touchpoints.find((t) => t.idx === c.credited.primary_touch_idx);
console.log(credited?.source, credited?.campaign, c.value, c.refunded);
// 3. First and last touch of the visitor at checkout (the gs_vid cookie).
const gsVid = checkoutRequest.cookies.gs_vid; // however your framework reads the visitor's cookie
const visitor = await (await fetch(`${base}/visitors/${encodeURIComponent(gsVid)}`, { headers })).json();
console.log(visitor.first_touch?.source, visitor.last_touch?.source);Needs: conversions sent with your CRM's record id (any recipe above). Reading by API needs a key with the attribution:read scope.
gs_vid cookie (how), saved on the CRM record.external_id = the CRM record id and visitor_id = that saved value. Send later stages with the same external_id, or with their own id and parent_external_id = the lead's, so they share one journey.?external_id={record id} (the page opens straight on that lead).GET https://api.geoswap.co/v1/conversions?external_id=…, the attribution_conversion MCP tool, or POST https://api.geoswap.co/v1/conversions/search with the email in the body (scope attribution:lookup).utm_content), keyword (utm_term), landing page and referring site; the credited touch; every model's split; and the lead → deal chain. A lead that shows no touches had no visitor id or click id GeoSwap could match (see Lookup).