Key takeaways
- Website tracking has five layers: traffic sources, behaviour, conversions, revenue and identity. Most broken reports come from a gap in one layer, not from the analytics tool.
- Write a tracking plan before you add any code: one row per business question, with the event name, its parameters, whether it is a key event, and where it is sent from.
- Keep key events to the few actions that cost you money when they do not happen; marking scrolls or clicks as conversions makes conversion rate meaningless.
- Send purchases from your server with a transaction ID whenever you can, because payment-gateway redirects, closed tabs and ad blockers lose browser purchase events.
- Test tracking the way a customer arrives: open the exact published ad link in a clean browser, check the address bar still has its UTM tags, then confirm the visit in realtime.
Website tracking means recording four things about every visit: where it came from, what the visitor did, whether they took an action that matters to your business, and how much revenue followed. In practice that takes one analytics tag on every page, UTM tags on every link you pay for, a short list of events and key events written down in a tracking plan, and purchases sent from your server. Most teams that distrust their numbers do not have a bad tool; they have a gap in one of those pieces. This guide walks through each one, gives you a tracking plan template, and shows how to test that it all works before a campaign goes live.
Website tracking is the practice of collecting data about visitors’ sources, on-site actions, conversions and purchases through an analytics tag and server events, so that marketing activity can be tied to business results.
What should you track on a website?
Track five layers, in this order, because each one depends on the one before it. A conversion you cannot tie to a source answers half a question, and revenue you cannot tie to a person cannot tell you anything about lifetime value.
| Layer | Question it answers | What you collect | Where it usually breaks |
|---|---|---|---|
| 1. Traffic sources | Which channel and campaign sent this visit? | UTM parameters, ad click IDs, referrer | Untagged links, redirects that drop the query string |
| 2. Behaviour | What did people do on the site? | Page views and events such as scrolls, searches, form starts | Too many unnamed events, or the tag missing from some templates |
| 3. Conversions | Did they do the thing that matters? | Key events: sign-up, lead form, purchase | Too many key events, or a success page counted on every reload |
| 4. Revenue | How much money followed? | Purchase events with value, currency, items and a transaction ID | Purchases lost on the payment-gateway redirect |
| 5. Identity | Is this the same person as last week? | An anonymous ID, then a login, email or phone at sign-in | Cookies cleared or capped by the browser, separate domains |
If you only have a week, get layers 1 and 3 right. Clean sources plus two or three well-defined conversions already answer “which campaigns bring customers?”, which is the question most marketing budgets are actually waiting on.
How does website tracking work?
A short script, the tag, loads on each page, gives the browser an anonymous ID, and sends an event for every page view and every action you define to the analytics collector. The collector attaches each event to a session and a source, and reports are built from those events.
The source of a visit is decided from what arrives with the first page. In AdPix the precedence is fixed: an ad click ID such as gclid or fbclid wins, then the UTM medium, then the referrer, and if none of the three is present the visit is direct (AdPix docs). Other tools use similar logic, which is why the same mistakes produce the same “everything is direct” report in every tool.
Identity is the fragile layer. The anonymous ID lives in browser storage, so a visitor who clears cookies or switches browsers starts over as a new user. Browsers also limit that storage on their own: since March 2020 Safari’s tracking prevention deletes all script-writable storage, including LocalStorage, after seven days of Safari use without interaction with the site (WebKit). A customer who comes back after two weeks on an iPhone can look new. The fix is a deterministic signal: when someone signs in or leaves an email or phone number, tie the anonymous ID to that person. In AdPix that link is a confidence-1.00 “deterministic” edge, and events recorded before the sign-in are joined to the person at read time rather than rewritten, so the first campaign touch is kept (AdPix docs).
How do you write a tracking plan?
A tracking plan is a table with one row per thing you need to measure, agreed before anyone writes code. It is the single most useful document in website tracking because it turns “track everything” into a list a developer can build and a marketer can audit.
Build it in four steps:
- List the decisions. Write the five to ten questions your team needs answered each month, such as “which campaigns bring paying customers?” or “where do people abandon checkout?”.
- Map each question to an event. Use standard names where they exist (
sign_up,add_to_cart,purchase) and lowercase snake_case for your own. - Name the parameters. Decide what each event carries: a plan name, a value and currency, a form ID.
- Assign a source and an owner. Say whether the event fires in the browser, through Google Tag Manager or from the server, and who fixes it when it breaks.
Here is a starting template for a small online shop. The rows are hypothetical; replace them with your own.
| Business question | Event name | Parameters | Key event? | Sent from | Owner |
|---|---|---|---|---|---|
| Which campaigns bring visitors? | page_view (automatic) |
UTM tags on the landing URL | No | Tag | Marketing |
| Do people search for products we lack? | view_search_results |
search_term |
No | Automatic listener | Marketing |
| Which products get attention? | view_item |
items, value, currency | No | Browser | Developer |
| Where does checkout leak? | add_to_cart, begin_checkout |
items, value, currency | No | Browser | Developer |
| Did we sell? | purchase |
transaction ID, items, value, currency | Yes | Server | Developer |
| Do people ask for a quote? | quote_requested |
form ID, product category | Yes | Browser | Marketing |
| Did we refund? | refund |
transaction ID, value | No | Server | Finance |
Two rules keep the plan honest. Names must match exactly, because analytics tools treat Purchase and purchase as two different events; AdPix’s docs warn that a key event whose name matches nothing simply stays at zero with no warning (AdPix docs). And every key event must earn its place, which the conversion section below explains.
Which events are tracked automatically, and which do you add?
Page views are always tracked automatically, and most tools can also catch common interactions without code. Anything tied to money, such as a sign-up, an add-to-cart or a purchase, you send yourself.
Google groups GA4 events into four kinds: automatically collected events, enhanced measurement events collected when that option is on, recommended events that you implement with predefined names, and custom events that you define (Google). Enhanced measurement covers page views, scrolls, outbound clicks, site search, video engagement, file downloads and form interactions (Google).
AdPix has the same six families of automatic listeners, configured per data stream, and a few details are worth knowing before you rely on them (AdPix docs):
- Scroll fires once, at 90% of the page. You will never see 25% or 50% depth from it.
- Site search only reads the URL, using the parameters
q,s,queryandsearch. A search box that loads results without changing the URL needs a manual event. - Form interactions cover every form, including the header search box and the newsletter field, so
form_startgets noisy on busy pages. - Video tracking hears the browser’s own video element only. Players inside an iframe, such as embedded YouTube or Aparat, produce no events.
AdPix’s docs also say plainly that these listeners attach once the configuration loads, so a click in the first fraction of a second can be missed; do not build commercial events on them. Send those with an explicit call or from your server, where the count is deterministic.
How do you track traffic sources with UTM parameters?
Add utm_source, utm_medium and utm_campaign to every link you publish outside your own website, especially any link with money behind it. Google’s guidance is to always use those three, and to set utm_id and utm_source_platform where relevant (Google).
Tagging matters more in Iran than the guides written for other markets suggest, because so much traffic arrives through channels that send no referrer. A link shared in Telegram or WhatsApp, a link in an email, a QR code or a link in a social bio all arrive as direct traffic unless they carry UTM tags (AdPix docs). If your Telegram channel or SMS campaigns look tiny in your reports, check the links before you cut the budget.
The second common leak is technical. The tag reads UTM parameters after every redirect has finished, so an http to https redirect, a www redirect or a trailing-slash rule that drops the query string turns a tagged visit into direct with no trace. Open the published ad link in a fresh tab and look at the address bar after the page settles. If the tags are gone, fix the redirect or point the ad at the final URL.
The UTM parameters guide covers the five tags, a naming convention a whole team can follow, and the mistakes that split one campaign into several rows. To build tagged links without typing them by hand, use the free builder:
How do you track conversions and key events?
Pick the two to five actions that make or lose you money, send each as a named event, and mark only those as key events (what older tools call conversions). Everything else stays an ordinary event you can still analyze.
The short list matters because key events feed several numbers at once. In AdPix a key event drives conversion rate in channel reports, becomes a selectable funnel step, and also counts toward the engaged-session definition, so marking scrolls or outbound clicks pushes conversion rate close to 100% (AdPix docs). A useful test: mark something a key event only if the business loses money or an opportunity on a day it does not happen.
Two AdPix behaviours differ from what GA4 users may expect. Marking an event as a key event applies to history immediately, because the conversion list is read when a report opens. And a page view cannot itself be a key event; if loading a thank-you page is your conversion, first create a named event with a rule on that URL, then mark it.
The classic conversion-tracking bug is the success page counted on every view. A rule keyed on a page URL fires again when the customer reloads the page, navigates back or reopens the receipt days later. AdPix’s documentation describes a real site where that rule, combined with a page view firing twice, reported 74 orders as 277 conversions (AdPix docs). The durable fix is to give each order an identity: once an event carries a transaction_id or order_id, repeat firings collapse into one and a genuinely new order still counts.
Worked example: how much does a reload bug inflate conversions?
Take a hypothetical shop with 500 real orders a month. Say 20% of buyers reload the thank-you page once and 5% open it again from their receipt email.
- Recorded conversions: 500 + (500 × 0.20) + (500 × 0.05) = 500 + 100 + 25 = 625.
- Inflation: 625 ÷ 500 = 1.25, so every conversion rate and cost per acquisition is off by 25%.
- If the month’s ad spend was 10,000 currency units, the report shows a cost per order of 10,000 ÷ 625 = 16, while the true figure is 10,000 ÷ 500 = 20.
A 25% error in cost per order is enough to keep funding a campaign that loses money. Compare recorded purchases with your order system every week, and the gap shows up within days.
How do you track e-commerce revenue accurately?
Track the shopping funnel in the browser and the purchase on your server. Product views, add-to-cart and checkout start happen on the page the customer has open; the payment happens elsewhere.
That split matters for Iranian shops in particular. Payment goes through a bank gateway on a different domain, and a customer who pays and closes the tab before being redirected back never loads your thank-you page, so a browser-only purchase event is lost. AdPix’s docs make the same recommendation for every site: send the gateway-confirmed purchase from your server, which an ad blocker or a closed tab cannot drop (AdPix docs).
Three fields decide whether revenue reports are usable:
transaction_idgives each order an identity. Google’s purchase-event example changes the transaction ID between purchases specifically “so Analytics doesn’t deduplicate the events” (Google). In AdPix, order count and average order value are grouped on it; without it, every purchase in the range falls into one group and AOV equals total revenue.itemscarries the line items. A purchase with no items appears in event counts but not in product reports.currencyas a three-letter code such asIRRorUSD. Without it, amounts pile up under “unknown”.
Once purchases are reliable, the funnel becomes trustworthy too. The sales funnel analysis guide shows how to choose funnel steps, read drop-off between them, and decide which leak to fix first.
Browser tag, tag manager or server-side: which setup fits?
Most sites should run one browser tag for behaviour and add server events for purchases. The table compares the three common setups honestly; none is best for every site.
| Setup | Strongest at | Weak spot | Fits |
|---|---|---|---|
| Tag pasted in the site template | Most accurate timing; nothing extra to load | Every new event needs a developer | Small sites with a developer on hand |
| Google Tag Manager | Marketers add events without a deploy | One more layer to debug; easy to install the tag twice | Teams already using GTM |
| Server-side events | Purchases, renewals, refunds, orders entered by staff; survives ad blockers and closed tabs | No page context: no page URL and no browser session | Any shop that takes payment through a gateway |
Two warnings apply to every setup. First, install the tag through exactly one path; the same tag in the template and in GTM loads two copies on one page (AdPix docs). Second, never send the same purchase from both the browser and the server, or each order is counted twice.
Google describes its own server-side tagging as a container that runs on a server you manage rather than in the visitor’s browser, which gives you control over how data is shaped and where it is sent (Google). That is a heavier project than sending a purchase from your backend, and most small shops only need the second.
How do you check that your tracking works?
Test it the way a customer arrives, not the way a developer browses. Run these checks before every campaign launch and after every site release.
- Clean-browser test. Copy the exact link from the live ad or newsletter, open it in a private window, and confirm the UTM tags survive in the address bar.
- Realtime check. Open the realtime report and confirm your own visit appears with the right source. In AdPix, realtime shows the visit within seconds, and the Test installation button in the data stream reports whether an event has arrived in the last 30 minutes.
- Consent check. If you run a consent banner, test once with acceptance and once with rejection, so you know which data is missing by design. Google notes that consent mode “does not provide a consent banner or widget” (Google), so with GA4 you need a separate banner; AdPix includes consent management from the Starter plan.
- Weekly reconciliation. Compare purchases in analytics with orders in your shop’s admin for the same dates. A small, steady gap is normal; a growing gap means a template lost its tag or a checkout step changed.
How do GA4 and AdPix compare for website tracking?
Both cover the core of website tracking: automatic page views, enhanced-measurement-style events, key events, e-commerce events and UTM campaigns. The differences are in hosting, sampling, advertising integration and what sits on top of the raw tracking.
| Criterion | GA4 (standard property) | AdPix |
|---|---|---|
| Automatic events | Page views plus enhanced measurement, including video progress milestones | Page views plus six listener families; video start and end only, browser video element only |
| Conversions | Key events; shareable as Google Ads conversions (better if you buy mostly Google Ads) | Key events that apply to history as soon as they are marked |
| Tag manager | Native Google Tag Manager | Install the snippet or import a GTM container; can read GA4 e-commerce events from the dataLayer |
| Report sampling | Possible on large queries | No sampling |
| Consent banner | Not included; use a CMP with consent mode | Built-in consent management from Starter |
| Hosting | Infrastructure inside Iran, Persian dashboard | |
| Raw data | BigQuery export (better for SQL teams) | Export any time |
| Measurement beyond tracking | Data-driven attribution and explorations | Funnels on every plan; invalid-traffic detection, lift tests and MMM from Starter |
If your team reaches Google reliably and buys mostly Google Ads, GA4’s native ads integration is a real advantage. The full comparison, including Matomo and the risks of relying on Google services from Iran, is in the Google Analytics alternative guide.
Where does AdPix fit in your tracking setup?
AdPix is a web analytics platform that replaces Google Analytics 4: realtime, acquisition, engagement, conversion and e-commerce reports, plus attribution, lift testing and marketing mix modelling, with no data sampling and a free plan. For tracking, that means one tag covers sources, events, funnels and e-commerce, and you can install it by adding the code or importing a GTM container in under five minutes. It runs alongside Google Analytics, so you can compare the two over the same weeks before deciding anything.
What each plan covers, per AdPix pricing:
- Free: realtime, acquisition and UTM reports, user journeys, conversion funnels, order analysis and the AI assistant, up to 100,000 events a month.
- Starter (499,000 toman a month): adds online sales and revenue analysis, consent management, segments and audiences, invalid-traffic detection, MMM and campaign lift, with 1 million events a month.
- Pro (2,990,000 toman a month): deeper channel analysis and true campaign impact measurement, with 5 million events a month.
To estimate your volume, count events, not visitors. A hypothetical site with 20,000 sessions a month, 3 page views per session and 2 other events per session sends 20,000 × (3 + 2) = 100,000 events, which is right at the Free plan’s limit. Switching off automatic listeners you never read, such as outbound clicks on a link-heavy page, keeps volume down. For a map of every AdPix capability by the question it answers, see the AdPix features overview.
Which tracking guides go deeper?
Each guide below takes one layer of website tracking further:
- Traffic sources: the UTM parameters guide gives the five tags and a naming convention that stays consistent across a team.
- Funnels and drop-off: the sales funnel analysis guide shows how to read the path from first visit to purchase.
- Credit across channels: the guide to attribution models compares last-click, first-click, linear and data-driven credit on one journey.
- What ads really caused: the incrementality testing guide explains lift tests and when attribution is not enough.
- Turning tracking into targets: the marketing KPIs guide and the ROAS formula show which numbers to report once the data is clean.
Start with the tracking plan. Write the five to ten questions, map each to one event, and test the two that involve money before your next campaign goes live.
UTM link builder
Tag campaign links so every click is credited to the right channel. The free plan covers 100,000 events a month, no credit card. Setup takes under five minutes.
Frequently asked questions
What is website tracking?
Website tracking is recording where visitors come from, what they do on your pages, which actions count as conversions and how much revenue they bring, using an analytics tag on every page. The goal is to connect marketing spend to business results.
What should I track on my website first?
Start with traffic sources (UTM-tagged links), page views, and the two or three actions that make you money, such as a purchase, a sign-up or a lead form. Add more events only when a specific report or decision needs them.
What is a tracking plan?
A tracking plan is a shared table listing every event your site sends, with its exact name, parameters, trigger, whether it is a key event and who owns it. It keeps names consistent across developers and marketers and makes broken tracking easy to spot.
Is server-side tracking better than browser tracking?
Neither replaces the other. The browser tag is the right source for page views and on-page behaviour; the server is the right source for purchases, renewals and refunds, which happen off the page and are lost when a customer closes the tab or blocks scripts.
Why does most of my traffic show as direct?
Usually the source signal was lost on the way: links in messaging apps and email carry no referrer, untagged campaign links carry no UTM parameters, and redirects can strip the query string before the analytics tag runs.
Can I track my website without Google Analytics?
Yes. Any web analytics tool with a tag on every page can track sources, events, conversions and revenue. AdPix, for example, installs with one snippet or a Google Tag Manager container and can run alongside GA4 while you compare.
Sources and methodology
Statements about GA4 come from Google's help center and developer pages listed in sources; the Safari storage limit comes from WebKit's own blog. AdPix behaviour (tag, automatic events, key events, event rules, e-commerce, source precedence, identity) comes from docs.adpix.io pages opened in October 2026, and plan placement from adpix.io/pricing. The tracking plan rows, order counts and event volumes in the examples are hypothetical.
- Google Analytics Help: About events
- Google Analytics Help: Enhanced measurement events
- Google Analytics Help: Mark events as key events
- Google Analytics Help: URL builders, collect campaign data with custom URLs
- Google Analytics Developers: Set up a purchase event
- Google Analytics Help: Consent mode on websites and mobile apps
- Google Tag Platform: An introduction to server-side tagging
- WebKit: Full Third-Party Cookie Blocking and More (March 2020)
- AdPix docs: Install the measurement tag
- AdPix docs: Enhanced measurement
- AdPix docs: Key events
- AdPix docs: Create and Modify event rules
- AdPix docs: E-commerce events
- AdPix docs: Everything says Direct
- AdPix docs: How AdPix identifies visitors
This article was drafted with AI assistance and reviewed by the AdPix team before publishing. Editorial policy