GA4 for Your Own Website: Event Tracking, Ecommerce Tracking, Cross-Domain, and Debugging
1. The Global GA4 Tag: Install gtag Directly or Go Through GTM?
Many teams get stuck on whether to paste gtag.js directly or use a GTM container. There’s only one test: does your site have anyone who isn’t an engineer changing tags? If a marketing colleague needs to add pixels or change conversion events on their own, use GTM. If you’re the only one maintaining it, gtag.js is lighter, with one less container and one less point of failure.
Here’s the counterintuitive part: GTM isn’t a cure-all. For small teams, GTM actually adds debugging cost, because tags, triggers, and variables nest three layers deep, and when something breaks you first have to figure out which layer failed. A B2B website changes its tags only a few times a year, so installing gtag directly costs less to maintain. For how to organize GTM itself, see Managing GTM Tags, Triggers and Variables.
| Deployment options | Best for | Pros | Cost |
|---|---|---|---|
| Direct gtag.js install | One maintainer, few tags | Short code, short debugging path | Changing tags requires a release |
| GTM container | Multiple collaborators, frequent pixel additions | Marketing can change tags on their own | Three layers of nesting, hard to troubleshoot |
| Google tag (merged gtag) | Running GA4 and Ads together | One piece of code for multiple products | Upgrade path is tied in |
2. Event Tracking: Choosing Between Automatic and Custom Events
GA4 collects a set of events automatically: page_view, session_start, first_visit, scroll, click, view_search_results. You get these without writing any code, but the granularity isn’t enough. The only events your own website really needs to define are 4: form submission (generate_lead), file download (a custom file_download), CTA click (cta_click), and video play (video_start). More events isn’t better; past 15 custom events, your reports become unreadable.
Event names must use GA4’s recommended snake_case: all lowercase, separated by underscores. Once you’re live and change a name, your historical data breaks. GA4 won’t automatically map an old event name to a new one; you can only build a mapping manually in event modifications, and it applies to future data only. For event naming conventions, see Structured Data Schema Markup Checklist naming conventions.
| Event name | Trigger | Required parameters | Purpose |
|---|---|---|---|
| generate_lead | Inquiry form submitted successfully | form_id、page_location | Inquiry conversion count |
| cta_click | Phone/WhatsApp button click | cta_type、cta_text | Contact button engagement |
| file_download | PDF/spec sheet download | file_name、file_type | Content asset usage |
| video_start | Product video starts playing | video_title | Video engagement |
3. Ecommerce tracking: should a B2B site install it?
Many pure B2B inquiry sites think, “I don’t run a shopping cart, so ecommerce tracking is useless to me.” Wrong. GA4 ecommerce events aren’t just purchase; from view_item and view_item_list to begin_checkout, they’re essentially a way to measure how far users travel through your product catalog. Even without online payment, a B2B site should fire view_item (product detail page view) and view_item_list (product list page view) so you can see which product pages are actually read in depth.
If you really do sell online (sample orders, spare parts orders, etc.), the purchase event must include both currency and value parameters; leave out either one and GA4 can’t calculate revenue. Use a three-letter code like USD for currency, and a number without a currency symbol for value. For how tracking works with forms, see Inquiry form reliability and spam protection.
| Ecommerce event | Required for B2B sites? | Required parameters | Consequence of skipping it |
|---|---|---|---|
| view_item | Required | item_id、item_name | Can’t tell which product pages get deep reads |
| view_item_list | Recommended | item_list_id | Product list page performance is a blind spot |
| begin_checkout | Only if you have a cart | value、currency | Checkout drop-off is invisible |
| purchase | Only if you sell online | transaction_id、value、currency | Revenue can’t be attributed |
4. Cross-domain measurement: configuring subdomains and third-party checkout pages
The most common cross-domain problem for independent sites: the main site is on www.example.com, the inquiry form submits to crm.example.com, or checkout redirects to pay.example.com. Without cross-domain setup, when a user moves from the main site to a subdomain, GA4 counts that move as a new session and the traffic source is lost.
To configure it, go to the GA4 admin under “Data streams → Tag settings → Configure your domains” and add example.com. Don’t add third-party payment domains (like stripe.com) — those belong to someone else. After configuring cross-domain, always test it: submit a form from the main site to the subdomain and check in DebugView whether session_id changes. For CRM field mapping, see Connecting Website Leads to the CRM.
| Cross-domain scenario | Needs configuration? | Where to configure | How to verify |
|---|---|---|---|
| www to blog subdomain | Yes | Add example.com to the domain list | Check in DebugView that session_id stays the same |
| Main site to checkout subdomain | Yes | Same as above | Channel parameters are preserved after the redirect |
| Redirect to third-party payment page | No | Don’t add third-party domains | Whether the session is rebuilt on return |
| Multiple languages in different subdirectories | No | Same domain, no cross-domain involved | Path changes don’t affect the session |
5. Debugging and validation: no validation means no tracking
There are three tools you need for debugging: GA4 DebugView, the GA4 Debugger Chrome extension, and GTM Preview mode. Your launch process should always be: open DebugView first, then walk the full path on your own site — homepage view, product page, form submission, file download — and at each step check whether the corresponding event shows up in DebugView and whether all its parameters are there.
One validation point that’s easy to overlook: event deduplication. If the form submit button has two triggers bound to it, one user click fires two generate_lead events and your data doubles instantly. Watch it in DebugView as you click once and check that exactly one event fires. After validating, monitor the Realtime report for 3 straight days to confirm the data isn’t just test traffic. For the day-to-day site monitoring checklist, see Site monitoring and alerts.
| What to check | Tools | Pass criteria | Common failure causes |
|---|---|---|---|
| Whether page_view fires | DebugView | Appears within 30 seconds of opening the page | Code in the wrong place or blocked by cache |
| Custom event parameters | DebugView details | Neither key nor value is empty | Variable pulls the wrong value or is undefined |
| No duplicate events | DebugView count | One action, one event | Trigger bound twice |
| Session continuity across domains | DebugView session_id | ID stays the same after crossing domains | Cross-domain domains missing from config |
| Data reaches the standard reports | Realtime report | Data aggregates normally the next day | Debug mode left on and polluting data |
6. Monthly review after launch: how to spot data drift
GA4 isn’t a set-it-and-forget-it install. Run a data health check once a month and focus on three anomalies: session volume suddenly drops by half, most likely because your code was overwritten by cache or your CDN rules changed; a custom event reads zero for two weeks straight, which isn’t users suddenly stopping but a broken trigger; a batch of unknown channels suddenly shows up in traffic sources, so check whether someone is misusing your UTMs.
Add the monthly review to your Six Monthly Tasks for Site Maintenance checklist and run it on the 1st of every month. B2B sites have low traffic, so a single week of data won’t reveal problems — compare week over week and month over year to surface anomalies. Save a screenshot from every review; pulling it out three months later to compare trends is more useful than staring at the numbers themselves.
| Warning sign | Possible Cause | Troubleshooting order | Fix actions |
|---|---|---|---|
| Session volume drops 50% week over week | Code overwritten by cache or CDN rules changed | Check CDN cache rules → check page source → check GTM publish history | Purge cache or roll back the tag version |
| A custom event reads zero for two weeks | Trigger broke or the selector changed | Open DebugView and click once manually → check trigger matching | Fix the CSS selector or reselect the element |
| Unknown channels spike in traffic sources | UTM misuse or malicious crawlers | Check landing pages and referring domains → filter out crawlers | Add filter rules or correct your UTM conventions |
| Event parameters go empty | Variable fails to pull a value | Check details in DebugView → check the variable definition | Fix the variable mapping |
FAQ
How long after installing GA4 does data show up in reports?
My B2B inquiry site doesn’t do ecommerce. Do I still need ecommerce events?
After configuring cross-domain tracking, why does the session still break?
How many custom events should I create?
Can’t see my test traffic in GA4 DebugView?
My daily traffic is very low. Is GA4 data statistically meaningful?
Final thoughts
Setting up GA4 isn’t technically hard. The hard part is making sure someone owns verifying it after install. Plenty of teams paste in gtag, call it done, and three months later realize their form events never fired — every data-driven decision they made in the meantime was built on nothing.
Three steps to get it live: First, install the global tag either directly with gtag or through GTM — pick one, don’t run both. Second, keep custom events to 4-8, each tied to a real business question. Third, on launch day open DebugView and walk the full path, check Realtime on day 3, and confirm data is aggregating properly on day 7. Once the data pipeline works,Independent Site Technology every other optimization has a measurement baseline.
One line worth remembering: launching GA4 tracking without checking DebugView is like installing a power meter but never wiring it up — you’ll never know whether the lights are on.
