Google Analytics tracking

Set a GA4 Measurement ID on your account and ListBee injects gtag.js on every product page and thank-you page it hosts. No code changes required on your end.

When a buyer completes a purchase, ListBee fires a purchase event with transaction_id, value, and currency. UTM parameters flow through to GA4 campaign attribution.

GA4 tracking is opt-in. If ga_measurement_id is not set, no GA script is injected — zero impact on existing sellers.


Set your Measurement ID

PUT /v1/account accepts ga_measurement_id. The format must match G-XXXXXXXXXX (where X is alphanumeric). Pass null to clear it.

1import httpx
2
3resp = httpx.put(
4 "https://api.listbee.so/v1/account",
5 headers={"Authorization": "Bearer lb_..."},
6 json={"ga_measurement_id": "G-ABC123XYZ"},
7)
8account = resp.json()
9
10print(account["ga_measurement_id"]) # G-ABC123XYZ

To remove tracking, pass null:

1httpx.put(
2 "https://api.listbee.so/v1/account",
3 headers={"Authorization": "Bearer lb_..."},
4 json={"ga_measurement_id": None},
5)

What gets injected

When ga_measurement_id is set, ListBee injects the standard gtag.js snippet on two pages:

  • Product page — the checkout page buyers see when they click your listing URL
  • Thank-you page — shown after successful payment

On the thank-you page, ListBee automatically fires a purchase event:

1{
2 "transaction_id": "ord_...",
3 "value": 19.00,
4 "currency": "USD"
5}

Nothing else is required. No script tags, no third-party plugins.


UTM parameters

Each listing has three optional UTM fields: utm_source, utm_medium, and utm_campaign. They control the campaign attribution passed to GA4 when a buyer lands on the product page.

Defaults (applied at render time if fields are null):

FieldDefault
utm_sourcelistbee
utm_mediumproduct_page
utm_campaignListing slug

You only need to set UTM fields if you want to override the defaults. The fields are stored as null on the listing when using defaults — the actual values are applied when the page renders.

Create a listing with custom UTM fields

1import httpx
2
3resp = httpx.post(
4 "https://api.listbee.so/v1/listings",
5 headers={"Authorization": "Bearer lb_..."},
6 json={
7 "name": "Python Async Patterns",
8 "price": 1900,
9 "deliverable": "https://my-bucket.s3.amazonaws.com/python-async.pdf",
10 "utm_source": "newsletter",
11 "utm_medium": "email",
12 "utm_campaign": "march-2026-launch",
13 },
14)
15listing = resp.json()
16
17print(listing["utm_source"]) # newsletter
18print(listing["utm_medium"]) # email
19print(listing["utm_campaign"]) # march-2026-launch

Create a listing using defaults

Omit the UTM fields entirely. ListBee uses listbee / product_page / <slug> at render time.

1import httpx
2
3resp = httpx.post(
4 "https://api.listbee.so/v1/listings",
5 headers={"Authorization": "Bearer lb_..."},
6 json={
7 "name": "Python Async Patterns",
8 "price": 1900,
9 "deliverable": "https://my-bucket.s3.amazonaws.com/python-async.pdf",
10 },
11)
12listing = resp.json()
13
14# UTM fields are null — defaults apply at render time
15print(listing["utm_source"]) # None
16print(listing["utm_medium"]) # None
17print(listing["utm_campaign"]) # None

Update UTM fields on an existing listing

1import httpx
2
3resp = httpx.put(
4 "https://api.listbee.so/v1/listings/python-async-patterns",
5 headers={"Authorization": "Bearer lb_..."},
6 json={
7 "utm_source": "twitter",
8 "utm_medium": "social",
9 "utm_campaign": "april-promo",
10 },
11)
12listing = resp.json()
13print(listing["utm_campaign"]) # april-promo

Field reference

Account

FieldTypeDescription
ga_measurement_idstring | nullGA4 Measurement ID. Format: G-XXXXXXXXXX. Set to null to disable tracking.

Listing (create and update)

FieldTypeMax lengthDescription
utm_sourcestring | null100UTM source sent to GA4. Defaults to listbee.
utm_mediumstring | null100UTM medium sent to GA4. Defaults to product_page.
utm_campaignstring | null100UTM campaign sent to GA4. Defaults to the listing slug.

Next steps

  • Listings — create and manage listings.
  • Payments — understand how purchases are processed.

Copy for AI assistants

Cursor / Claude Code
1# ListBee — Google Analytics tracking
2#
3# Setup:
4# PUT /v1/account { "ga_measurement_id": "G-XXXXXXXXXX" }
5# Format: ^G-[A-Za-z0-9]+$ (pass null to disable)
6# → AccountResponse with ga_measurement_id field
7#
8# What gets injected (when ga_measurement_id is set):
9# - gtag.js on product pages and thank-you pages
10# - purchase event on thank-you page:
11# { transaction_id: "ord_...", value: 19.00, currency: "USD" }
12#
13# UTM fields (on CreateListingRequest / UpdateListingRequest):
14# utm_source — default: "listbee"
15# utm_medium — default: "product_page"
16# utm_campaign — default: listing slug
17# All three: string | null, max 100 chars
18# null means defaults apply at render time (not stored)
19#
20# No tracking injected when ga_measurement_id is null — zero impact on existing sellers
21#
22# Auth: Authorization: Bearer lb_...
23# Docs: https://docs.listbee.so/analytics