Sub topic 11
Choosing once per event or once per session
This chapter assumes you can already send a generate_lead or purchase event and mark it as a key event. It covers the setting that decides how many times GA4 counts that key event when it fires more than once.
What the counting method controls
Each key event has a counting method. You change it in Admin, under Data display, then Key events. It takes one of two values:
- Once per event: every occurrence of the event counts as a key event.
- Once per session: the event counts at most once in each session, however many times it fires.
The setting changes the numbers in the key event columns of your reports. It does not change what GA4 collects. The raw event is still stored, and the ordinary event count still shows every occurrence.
Suppose a visitor submits your contact form three times in one session. Maybe they fixed a typo, or the page reloaded and resent the event. The table shows what each method reports.
| Method | Event count | Key events |
|---|---|---|
| Once per event | 3 | 3 |
| Once per session | 3 | 1 |
How the choice flows
The decision depends on what one occurrence of the event means for your business. Ask whether a second occurrence in the same session is a separate outcome or a repeat of the first.
Choosing for a sale
A purchase is almost always a separate outcome. A shopper can place two orders in one session, such as a gift for a friend followed by one for themselves. Each order brings revenue, so each should count.
Use once per event for purchase. If you chose once per session, the second order would not appear in the key event count, and your key event numbers would fall below your real order count.
Once per event does not make duplicates harmless. If the order confirmation page is reloaded and fires purchase again with the same transaction_id, GA4 treats it as a repeat of the same transaction. It does not add a second purchase. This protection comes from the transaction_id parameter, not from the counting method. Send a unique ID with every purchase. You will see the details in the chapter on duplicate prevention.
// Two real orders in one session: both must count.
// Different transaction_id values mean GA4 sees two separate purchases.
gtag('event', 'purchase', {
transaction_id: 'T_12345',
value: 59.98,
currency: 'USD'
});
gtag('event', 'purchase', {
transaction_id: 'T_12346',
value: 24.50,
currency: 'USD'
});Choosing for a lead
Leads are less clear-cut. Consider two businesses.
A roofing company has one contact form. A person who submits it twice in one visit is still one potential customer. Repeat submissions inflate the lead count, so once per session is a good fit.
A software marketplace lets visitors request a quote from several vendors in one visit. Each request is a distinct lead that a different vendor will follow up on. Here once per event is the better choice.
Use these questions to decide:
- Does a second occurrence represent a new person, order, or request that your team must act on?
- Do you pay for or are you paid per occurrence, or per visit?
- Can the event fire by accident, for example from a double click, a page refresh, or a form that re-sends after a validation error?
If the answer to the first question is yes, count every event. If the answer to the third is yes and the first is no, count once per session.
Counting method does not fix a broken tag
Once per session can hide a tag that fires too often, which looks like a fix but only masks the problem. If a lead event fires on every page load because the trigger is wrong, once per session will show one lead per session. That number looks reasonable but may be wrong. Every session that visits the thank-you page would count, including people who never submitted the form. Fix the trigger first, then choose the counting method.
Choosing for other key events
For events that describe engagement rather than a transaction, once per session is usually the better fit. Examples are video_complete, file_download, and click on a phone number. One user may play the same video five times. You usually want to know how many sessions included that behavior, not how many times it happened.
| Event | Typical choice | Reason |
|---|---|---|
| `purchase` | Once per event | Each order is a separate sale |
| `generate_lead` (single form) | Once per session | Repeat sends are usually the same person |
| `generate_lead` (multiple vendors or products) | Once per event | Each request is a separate lead |
| `file_download` | Once per session | You want sessions with a download |
| `sign_up` | Once per event | Rarely repeats, so the choice has little effect |
Where and when the setting applies
- It is set per event. Each key event has its own counting method. Changing one does not affect the others.
- It is not retroactive. Reports show the new method only for data collected after you change it. Older rows keep the old method. If you compare date ranges that span the change, write down the change date.
- It affects shared numbers. Key event counts also feed into Google Ads when you import them, and into audiences and other features that use key events. Check those places after a change.
- Defaults vary. The default shown for a newly marked event can differ by event name and by when your property was created. Open the setting for each event and confirm it, rather than assuming.
Because the setting is not retroactive, make the decision before you rely on the data for a campaign review.
A worked check
Counting rules are easy to misjudge, so test your choice with a small model. This script mimics the two methods on a list of events from one session. It uses only the standard library and runs as shown.
from collections import Counter
# (session_id, event_name) pairs, in the order the events fired
events = [
("s1", "generate_lead"),
("s1", "generate_lead"),
("s1", "generate_lead"),
("s2", "generate_lead"),
("s3", "purchase"),
("s3", "purchase"),
]
def count_key_events(events, method):
"""Return key event counts per event name for a counting method."""
if method == "once_per_event":
return Counter(name for _, name in events)
if method == "once_per_session":
unique = set(events) # at most one per (session, event)
return Counter(name for _, name in unique)
raise ValueError("method must be once_per_event or once_per_session")
for method in ("once_per_event", "once_per_session"):
print(method, dict(count_key_events(events, method)))The output shows generate_lead counted four times under once per event and twice under once per session. The two purchase events in session s3 count as two or as one. Compare these numbers with your real order and lead records to see which method matches how your business counts outcomes.
Verify after you change the setting
- Open Admin, then Data display, then Key events, and confirm the method on each row.
- Trigger the event twice in one session on a test device.
- Use DebugView to confirm that the event arrives twice.
- The next day, compare the Event count and Key events columns for that event in a report. Under once per session, Key events should be lower than Event count when an event repeats.
Reports can lag, so do not judge the change from Realtime alone.
Exercise
A tutoring site has one "Book a free trial" form. Visitors often submit it, see an error, fix a field, and submit again, so generate_lead can fire two or three times for one person. Which counting method fits, and why? What would change your answer?
Show answer
Once per session fits, because repeated submissions in a session come from one person and would inflate the lead count. Your answer would change if one visit could produce distinct leads that your team handles separately, for example one form per child or per course. In that case use once per event. Also check that the tag fires only after a successful submission, because once per session does not fix a trigger that fires too early.
Exercise
Your purchase event uses once per event. A customer reloads the order confirmation page, and the event fires again with the same transaction_id. Does the counting method decide whether GA4 counts a second purchase?
Show answer
No. The transaction_id is what prevents the duplicate, since GA4 recognizes the repeated ID as the same transaction. The counting method decides how many separate occurrences count in a session. Two orders with different IDs should both count under once per event.