comecerodocs
Settings reference

Analytics

Send storefront page views and purchases to Google Analytics 4 and Google Ads conversions, and add your own tracking code to the hosted storefront.

Your analytics settings add tracking to the hosted storefront: Google Analytics 4, Google Ads conversion tracking, Matomo and your own JavaScript. Comecero builds the tracking scripts from these settings and the storefront loads them, so you add no code.

Change them in the dashboard under Settings > Analytics, or with Update analytics settings. The change shows on the next page load. Settings are kept per mode, so set them again in live mode.

The Google Analytics 4 and Google Ads sections of the analytics settings

The settings

DashboardAPI fieldFormat
GA4 Measurement IDga4_measurement_idG-XXXXXXXXXX, from GA4 under Admin, Data Streams
Google Ads Conversion IDgoogle_ads_idAW- and digits, such as AW-123456789, from Google Ads under Tools, Conversions
Conversion Labelgoogle_ads_labelLetters, digits, _ and -. In the Google Ads tag AW-123456789/AbC_dEfGh-12, it is the part after the slash
Custom Pageview Tracking Codepageview_trackingYour own JavaScript, run on every page view (up to 5,000 characters)
Custom Conversion Tracking Codeconversion_trackingYour own JavaScript, run once when an order is completed (up to 5,000 characters)

A value in the wrong format is refused with 400. google_tracking_id (Universal Analytics, UA-) still exists but is deprecated, since Google retired Universal Analytics.

Request
curl https://api.comecero.com/api/v1/settings/analytics \
  -H "Authorization: Bearer $COMECERO_TEST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "ga4_measurement_id": "G-4X7KQ2M9PL",
    "google_ads_id": "AW-123456789",
    "google_ads_label": "AbC_dEfGh-12"
  }'

What the storefront sends

When either Google setting is set, the storefront loads Google's gtag.js.

Google Analytics 4, with ga4_measurement_id set:

  • A page view on each storefront page, with the page path and title.
  • A purchase event on the receipt page, with transaction_id (the order id), value (the order total), currency, tax, shipping and items. Each item has item_id (the product id), item_name, price and quantity.

Google Ads, with both google_ads_id and google_ads_label set:

  • A conversion event on the receipt page, sent to google_ads_id/google_ads_label, with value (the order total), currency and transaction_id (the order id). With only one of the two set, nothing is sent to Google Ads.

Your own code runs on every page view (pageview_tracking) and once on the receipt page (conversion_tracking).

Tracking never loads on the card entry or customer account pages.

Matomo

To send storefront data to your own Matomo, set matomo_url (the HTTPS address of your Matomo) and matomo_site_id. send_events sends shopper events, such as add to cart, and send_transactions sends completed orders as ecommerce transactions. These two only work with Matomo. A Matomo API token (matomo_token_auth) can be saved but is never returned: has_matomo_token_auth says whether one is set.

Your own checkout

These settings only drive the hosted storefront. If you build your own checkout with the API, send page views and purchases from your own pages. The order:created webhook gives you the order id, total and items for a server-side purchase event.

On this page