Skip to content

Google Analytics 4 on hosted cartonium checkout

Hosted cartonium checkout can send a sanitized page view, checkout start and confirmed purchase to your GA4 property for ordinary, one-time cart checkout. Booking, subscription, order-status and account pages are outside this integration.

Rollout boundary

These instructions apply to the replacement release on an environment that has received it. Preview and Production are released and configured independently. A newly loaded checkout on this release sends nothing until the store has an active acknowledged configuration and checkout confirms the applicable consent. An existing measurement ID by itself does not activate it. A page already running the earlier release can still send under the old rules until reload or close, including after an in-place restart. Events missed during the switch are not replayed.

Configure it

  1. Choose a GA4 web data stream for the environment. Use a separate property for Preview so test orders stay out of production reports.
  2. In Merchant Admin, open Settings → Checkout → Google Analytics 4. Confirm the existing measurement ID or enter the intended stream's G- ID. Select Require shopper opt-in, or Collect unless the shopper opts out and select the countries or territories where that policy applies. Outside those regions, or when a country cannot be determined, checkout requires a confirmed Allow. Choose whether the storefront checks consent again on return.
  3. Publish the privacy notice for this configuration. An Owner or Admin acknowledges the disclosure in the same form and saves. That save binds the settings and acknowledgement to this store and environment. Saving a draft alone does not enroll the store. If setup is unavailable, check the environment before sending shoppers through the release.
  4. Verify the public store configuration reports replacementInForce: true and active: true. Use the onboarding checklist to verify the storefront handoff and a permitted checkout. Disable turns collection off. Changing the ID, mode or regions requires a fresh acknowledgement. An enrolled store never falls back to the earlier sender.

The measurement ID is public. Use the consent handoff guide to integrate a storefront with the same store and environment.

Environments

You are onThe value you save reachesRecommended property
admin.preview.litecommerce.io{tenant}.preview.litecheckout.io onlya Preview-only GA4 property
admin.litecommerce.io{tenant}.litecheckout.io onlyyour production property

Each environment stores its own value, and cartonium checkout additionally refuses to render the tag unless the request host is exactly your tenant's canonical host for that environment — never a per-PR deployment URL or a local development host. Prefer a separate property over GA4 data filters for test traffic: a filter is permanent once applied and the filtered stream still receives the events.

What cartonium checkout sends

After checkout confirms permission, the tag loads gtag.js from www.googletagmanager.com as an ordinary asynchronous script after the page has rendered — it never blocks checkout, and a blocked or failed load leaves checkout untouched. Google serves gtag.js unversioned, so it cannot carry Subresource Integrity; the platform admits it by host allowance on the checkout-session route only. The tag runs with:

  • send_page_view: false — the automatic page view is replaced by the sanitized manual one below;
  • page_location fixed at config level to https://{your checkout host}/session; cartonium checkout's own in-page URL changes (after a payment-provider return and when an expired checkout is recovered in place) go through a history.replaceState reference captured before the tag loads, so the tag's history hook never sees them and a history-based page view cannot carry the checkout link — that bypass is the guard, and the sanitized location is re-applied afterwards only so later events keep it;
  • page_referrer fixed at config level to the referrer's origin only;
  • cookie_domain pinned to your exact checkout host, so _ga is never shared across tenants on litecheckout.io;
  • allow_google_signals: false and allow_ad_personalization_signals: false;
  • no user_id, no user properties, and no debug mode.
EventWhenParameters and where they come from
page_viewone manual page view per checkout page load, sent by cartonium checkout (cartonium checkout's own in-page URL changes, after a payment-provider return and when an expired checkout is recovered in place, are invisible to your stream's history-events option, so that option adds no page views here)page_location = https://{tenant}.litecheckout.io/session in production and https://{tenant}.preview.litecheckout.io/session on Preview (the checkout token and every query parameter are removed); page_referrer = the referrer's origin; page_title = "Secure checkout".
begin_checkoutat most once per checkout session per browser tab, when a payable start qualifiescurrency (ISO 4217, upper case); value; items.
purchaseafter a qualifying payable observation and server-confirmed order number, while consent still covers the eventtransaction_id = your order number; currency; value; tax; shipping; items.

Per Google's guidance, value is the sum of price × quantity over the items after discounts and excludes shipping and tax; both ride separately on purchase. A cart-level discount is allocated across the lines in proportion to their totals, so each entry in items carries item_id (the catalog variant id, or the item id when the line has no variant), item_name (the line name as it appears on the order), price (the discounted unit price), discount (the per-unit reduction, when a discount applies), and quantity. Unit prices may carry more decimals than the currency's minor unit so that item revenue and value reconcile exactly. Amounts are reported in major units at the currency's own precision (a zero-decimal currency such as JPY reports whole yen). Package component rows are excluded so item totals reconcile to the subtotal.

Why the purchase is verified and not duplicated

The purchase never fires from the Stripe return URL's redirect_status — that lands before the payment webhook and could be forged. It fires only when the authoritative session read says CONFIRMED and carries the order number, and the replacement records an opaque purchase marker after obtaining its browser lock. Reloading a confirmed order supplies no new payable observation. If consent or the coordination needed to send cannot be confirmed, checkout omits the event. GA4 additionally deduplicates web-stream purchases that share a transaction_id.

What is never sent

The checkout link token, the Stripe PaymentIntent client secret, card data, the shopper's email, phone, name, addresses, customer id, and account state. Unit tests pin these exclusions on every payload and on page_location.

Enhanced measurement on your stream

GA4's enhanced measurement settings belong to your data stream and stay under your control. cartonium checkout neutralizes the automatically collected parameters that could otherwise carry the checkout URL: every form on the checkout page has a sanitized action (form_destination = /session), the referrer is origin-only, the outbound-click link_url can only ever be a link you configured (your store, your policies, your support contact — never a checkout or order-status link), and cartonium checkout's own in-page URL changes bypass the tag's history hooks, so the history-events option never sees them. If a shopper's content blocker stops the primary collection endpoint, the tag retries on www.google.com, which the checkout policy deliberately excludes, so the browser blocks the retry and no analytics hit reaches Google. The checkout address carries the checkout token, so the page sends no Content-Security-Policy violation report for the block; it shows only in the browser console. If you do not want form-interaction, outbound-click, site-search, or history-based page-view events from checkout at all, turn those options off on the stream; the platform does not change your stream settings.

The replacement requires a confirmed shopper Allow or a currently qualified regional opt-out policy for this checkout. A known Decline stops both paths. Advertising storage, ad personalization and Google signals remain off. Checkout stops sending within 30 seconds of a durably accepted withdrawal for that checkout. Closing a tab or clearing browser storage does not record a withdrawal. See the consent handoff guide for withdrawal, return and storage limits. An older page still running the pre-release integration follows the cutover exception above.

Keep attribution across your storefront and checkout

Your storefront and {tenant}.litecheckout.io are different domains. This section applies to shoppers for whom analytics collection is permitted on both surfaces. Google's cross-domain linker can carry the client ID into checkout. To keep the storefront visit and checkout in the same session:

  1. Install the same measurement ID on your storefront (the Preview ID on your preview storefront, the production ID on your production storefront), in the top-level document. Google's cross-domain linker works only when the storefront tag can keep the _ga cookie and decorate the links on the page. A tag loaded in a sandboxed or opaque-origin frame can do neither, so the checkout visit starts a new client no matter what else you configure.
  2. In GA4 admin, under the web data stream's tag settings, configure your domains to include both your storefront host and your same-environment checkout host ({tenant}.litecheckout.io for production, {tenant}.preview.litecheckout.io for Preview). Google's tag then decorates navigation between them with the _gl linker parameter. This helps only when your storefront tag can decorate; otherwise it merely adds _gl to hosted checkout's "Return to store" links.
  3. Under list unwanted referrals, add stripe.com, so a shopper returning from a 3-D Secure or bank redirect is not counted as a new referral session.
  4. Make the handoff to checkout a link the shopper clicks. Google documents that the linker decorates link clicks and form submissions, not navigation triggered purely by JavaScript. If your storefront creates the checkout session and then navigates with window.location, the checkout page arrives without _gl and GA4 starts a new session attributed to a referral from your storefront. Render the session URL as an anchor once the session exists, or trigger the navigation through a real anchor click, and verify in your browser that the cartonium checkout URL carries _gl.
  5. Keep Google signals off on the property. The hosted tag disables them, and the checkout CSP deliberately admits no advertising endpoints, so a property with signals on produces blocked requests rather than data.

The "Return to store" link on the confirmation page is an ordinary anchor, so the return trip is decorated automatically once your domains are configured.

Verify

GA4's DebugView shows only sessions running in debug mode, and the hosted tag never sets debug_mode, so enable a debug session in your own browser first (Google's Analytics Debugger extension, or the steps DebugView itself lists) — otherwise DebugView stays empty even though events are arriving. The Realtime report needs no setup and shows the same events with a short delay. Grant consent on a Preview storefront, open its canonical checkout through the storefront handoff, and verify the permitted session uses the Preview property. Confirm the checkout start before completing a test payment. You should see one page_view whose location ends in /session with no token, one begin_checkout with the expected value and items, and exactly one purchase with transaction_id equal to the order number — and no second purchase after reloading the confirmation page. In the browser's network panel, every request to Google hosts should be free of the checkout token, the client secret, and any customer detail. Requests the checkout page's Content-Security-Policy blocks (for example advertising endpoints from a property with signals on) show as CSP violations in the browser console.

Who owns what

cartonium owns the tag, the events and their payloads, the consent defaults, and the checkout page's Content-Security-Policy, and can remove the Google hosts from that policy in an emergency. You own the GA4 property, its data-stream settings (including enhanced measurement), your storefront tag, and your privacy disclosure. Clearing the measurement ID invalidates the active configuration. An open replacement checkout stops within 30 seconds of the saved change. An older checkout already running the earlier release follows the cutover rule above.

Limits: browser analytics versus your order ledger

GA4 counts what a browser managed to send. It undercounts and cannot be reconciled to Admin:

  • ad blockers and privacy browsers block the tag host outright;
  • a shopper who closes the tab before the confirmation renders sends no purchase;
  • an ineligible checkout or a checkout without confirmed permission sends nothing;
  • Safari caps script-set cookies at seven days, so returning-visitor attribution decays;
  • orders placed through POS, Merchant Admin, invoices, bookings, or subscriptions never pass through the tag;
  • refunds, cancellations, and chargebacks are not reflected.

The Orders ledger in Merchant Admin and its exports remain the only source of truth for revenue and order counts.

Not included

add_shipping_info and add_payment_info, SKU and coupon codes on the items, server-side Measurement Protocol delivery (including refund), tags on the order-status or account surfaces, Google Tag Manager, advertising pixels, a consent banner, and a preference center. The guide and checklist linked above describe the consent handoff, merchant setup and the checks to run on the release in each environment.