OpenCart 2.3–4.1 extension

Supreme Tracking Hub

One place for Google Analytics 4, Google Ads and the Meta Pixel. Product views, add to cart, checkout and purchase are sent from the visitor's browser. Every purchase is also sent from your server (GA4 Measurement Protocol and the Meta Conversions API), and product views, add to cart and checkout go from your server to Meta too, all with matching event ids: what a blocker hides from the browser is still counted, and nothing is counted twice. Nothing is sent until the visitor agrees.

$20
Supreme Tracking Hub — overview

For OpenCart 2.3, 3.0, 4.0 and 4.1

NEW IN 1.1: SERVER SIDE VIEWCONTENT, ADDTOCART AND INITIATECHECKOUT FOR META

Events

  • view_item / ViewContent on product pages, add_to_cart / AddToCart when a product is added (with the product's own price when it is known on the page), begin_checkout / InitiateCheckout on the checkout page (the One Page Checkout page is included) and purchase / Purchase on the thank-you page.
  • The purchase carries the order id, the value, tax, shipping, currency and the order lines. It is sent once per order: reloading the thank-you page does not repeat it, and nobody else can see an order on it.
  • Google Ads: a purchase conversion with your conversion label, value and transaction id; optional enhanced conversions (the buyer's e-mail, hashed, after marketing consent).
  • Google Tag Manager (optional): your container loads with the same consent rules, and the ecommerce events go into the dataLayer in GA4 form for your own tags.
  • Each event can be switched off (views, cart, checkout).

Consent

  • Works with Supreme Cookie Consent: analytics events need "analytics" to be allowed, Meta and Google Ads events need "marketing". A choice made under an older policy version counts as no choice. When the visitor accepts on the banner, the waiting events go out at once; when they withdraw, Google is told "denied".
  • Before any choice nothing is loaded: no Google tag, no Meta script, no event.
  • Optional advanced Google Consent Mode: the Google tag loads at once with all four storages (analytics, ad storage, ad user data, ad personalisation) denied and is switched on by the choice, so Google can model what it cannot measure.
  • For shops that need no choice there is an "always on" setting.

Server side purchase

  • GA4: measurement id + API secret; the visitor's _ga client id is used when the browser has one.
  • Meta: pixel id + access token; the buyer's e-mail and phone are sent only as one-way sha256 hashes (trimmed, lower case / digits only), together with the browser id and click id, network address and browser name. The event id (thb_o + order number) is the same one the browser pixel uses, so Meta joins the two. A test event code can be set while you check Events Manager.
  • Sent only when the visitor agreed to that channel at the time of the order, only for orders in a processing or complete status, and once per order and channel. A server that refuses is logged as failed (with its answer) and tried again the next time the order changes; the order itself is never held up.
  • The API secret and the access token are never written into the page.

Admin

  • One settings page with a card per service, the numbers of the last 30 days (sent and failed per channel) and a paged log of every server send with the answer.
  • Ids are checked: a value that does not look like a real id is not kept, so a typo cannot put broken code on every page.
  • Admin only: viewing needs Access, saving needs Modify.
  • The send log is kept if you uninstall.

Notes

  • Server side purchases need the visitor's consent cookie to reach your server: orders confirmed by a payment gateway's own callback (no visitor cookies) are sent from the browser on the thank-you page only, unless "always on" is chosen.
  • Google Ads conversions are sent from the browser only (a server side upload needs a Google Ads developer token, which this module does not use).
  • Without a _ga cookie the GA4 server event uses an id made from the order, so it can show as a separate user.
  • Meta Conversions API deduplication needs the browser pixel to run too: a visitor who allowed marketing but blocks the pixel is counted once, from the server.
  • On a server with PHP-FPM the page is finished before Meta is asked. On other servers (for example Apache with mod_php) the page is sent first, but the connection stays open until Meta answers, at most 3 seconds and usually a fraction of a second.
  • A full-page cache that serves product pages without running OpenCart also skips the server copy of ViewContent for those pages (the pixel still sends it).
  • Anyone who may modify this module can change which tags are on every page of your shop. Give that permission with care.
  • Not legal advice: whether you may send an event depends on your visitors' consent and local law.

How it was tested

OpenCart 2.3.0.2, 3.0.5.1, 4.0.2.3 and 4.1.0.4, installed through the real admin installer, against a local stand-in for the Google and Meta servers (no real account was used). Each version passed 103 to 108 automated checks: consent, the server purchase, the new server ViewContent, AddToCart and InitiateCheckout with the event ids of the page, consent and search engine rules, switches, a refusing server, the send log and reinstall. The page script passed 32 checks of its own. An upgrade from 1.0 was tested on all four versions, with the settings kept. In Edge on 4.1, the product page, the shop's own add-to-cart button and the checkout page each gave the pixel and the server copy the same event id, with no script errors.

Screenshots

Supreme Tracking Hub — Admin settings part 1
Admin settings part 1
Supreme Tracking Hub — Admin settings part 2
Admin settings part 2
Supreme Tracking Hub — Backend details
Backend details

More modules

You May Also Need.

Supreme Address Autocomplete and Validation

Help shoppers fill in their address in a few keystrokes. As they type the street at checkout, a list of matching addresses appears; one click fills the street, city, postcode, country and state. You use your own free key from Geoapify or LocationIQ, so there is no middleman and no extra fee from us. No core files are changed.

Supreme Affiliate Dashboard Upgrade

OpenCart's own affiliate area only gives a tracking code. This module gives your affiliates a real dashboard, so they can see what they earn and share more, and you answer fewer "where is my commission?" emails.

Supreme Full-Page Cache for Guests

Send the finished catalogue pages to visitors at once instead of building them again for every visit. Pages are kept for guests who are not logged in and have an empty cart, and they are cleared the moment you change a product, a price, the stock or a setting. No core files are changed.

See all OpenCart modules