[{"data":1,"prerenderedAt":620},["ShallowReactive",2],{"post-\u002Fblog\u002Fmeasurement-plan-before-the-first-event":3,"post-related-\u002Fblog\u002Fmeasurement-plan-before-the-first-event":588,"post-translations-\u002Fblog\u002Fmeasurement-plan-before-the-first-event":610,"post-surround-\u002Fblog\u002Fmeasurement-plan-before-the-first-event":612},{"id":4,"title":5,"body":6,"category":392,"date":571,"description":572,"draft":573,"extension":574,"featured":573,"meta":575,"navigation":297,"path":576,"readingTime":294,"segment":577,"seo":578,"stem":579,"tags":580,"translationKey":585,"updated":586,"__hash__":587},"blog_en\u002Fblog\u002Fmeasurement-plan-before-the-first-event.md","A measurement plan before the first event: clean GA4, with consent",{"type":7,"value":8,"toc":563},"minimark",[9,29,34,37,59,62,66,69,124,207,219,223,230,237,466,473,477,480,514,520,524,527,552,556,559],[10,11,12,13,17,18,17,21,24,25],"p",{},"I've lost count of how many Google Analytics accounts I've seen like this: hundreds of events with similar names (",[14,15,16],"code",{},"click_button",", ",[14,19,20],{},"button_click",[14,22,23],{},"cta-click","), half of them without parameters, nobody knows who created them and nobody trusts the numbers. The tool isn't to blame. ",[26,27,28],"strong",{},"There was no plan before the first event.",[30,31,33],"h2",{"id":32},"start-with-the-questions-not-the-events","Start with the questions, not the events",[10,35,36],{},"The most common mistake is to track everything \"just in case\". That creates noise, cost and, under privacy laws like Brazil's LGPD and Europe's GDPR, risk. The opposite path works better:",[38,39,40,47,53],"ol",{},[41,42,43,46],"li",{},[26,44,45],{},"Which decisions will we make with this data?"," \"Is campaign X worth keeping?\", \"Did the new onboarding activate more people?\"",[41,48,49,52],{},[26,50,51],{},"Which questions answer those decisions?"," \"What's the cost per activated account, per channel?\"",[41,54,55,58],{},[26,56,57],{},"Which events and parameters answer those questions?"," Only now do you write the event.",[10,60,61],{},"If an event doesn't answer any question, it doesn't go in.",[30,63,65],{"id":64},"a-taxonomy-that-scales","A taxonomy that scales",[10,67,68],{},"Event names are an API: once published, changing them is expensive. A few rules I use:",[70,71,72,91,112,118],"ul",{},[41,73,74,80,81,17,84,17,87,90],{},[26,75,76,79],{},[14,77,78],{},"object_action"," in the past tense, in snake_case",": ",[14,82,83],{},"signup_completed",[14,85,86],{},"report_generated",[14,88,89],{},"plan_selected",". Putting the object first groups the events about the same subject together in the list.",[41,92,93,96,97,100,101,104,105,107,108,111],{},[26,94,95],{},"Parameters carry the context",", not the name. Instead of ",[14,98,99],{},"signup_google"," and ",[14,102,103],{},"signup_email",", one ",[14,106,83],{}," with ",[14,109,110],{},"method: 'google' | 'email'",".",[41,113,114,117],{},[26,115,116],{},"Names and values in English, with no accents or spaces."," It avoids surprises in reports and exports.",[41,119,120,123],{},[26,121,122],{},"A versioned dictionary."," A table in the repository with the event, when it fires, its parameters and who asked for it.",[125,126,127,143],"table",{},[128,129,130],"thead",{},[131,132,133,137,140],"tr",{},[134,135,136],"th",{},"Event",[134,138,139],{},"When it fires",[134,141,142],{},"Parameters",[144,145,146,163,178,192],"tbody",{},[131,147,148,154,157],{},[149,150,151],"td",{},[14,152,153],{},"signup_click",[149,155,156],{},"Click on any sign-up CTA",[149,158,159,162],{},[14,160,161],{},"location"," (hero, pricing, header)",[131,164,165,170,173],{},[149,166,167],{},[14,168,169],{},"price_interest",[149,171,172],{},"Pricing section visible for 2s",[149,174,175],{},[14,176,177],{},"currency",[131,179,180,184,187],{},[149,181,182],{},[14,183,83],{},[149,185,186],{},"Account created successfully",[149,188,189],{},[14,190,191],{},"method",[131,193,194,199,202],{},[149,195,196],{},[14,197,198],{},"first_value",[149,200,201],{},"First action that delivers value",[149,203,204],{},[14,205,206],{},"days_since_signup",[208,209,210],"note",{},[10,211,212,213,215,216,218],{},"Notice that ",[14,214,153],{}," happens on the site and ",[14,217,83],{}," in the app. The measurement plan crosses repositories, so it needs to be written somewhere both teams read.",[30,220,222],{"id":221},"the-event-ships-in-the-same-pr-as-the-feature","The event ships in the same PR as the feature",[10,224,225,226,229],{},"Measurement patched in later is always incomplete. The rule that works: ",[26,227,228],{},"a feature without its event isn't done",". The acceptance criteria include \"event X fires with parameters Y\", and the review checks it.",[10,231,232,233,236],{},"In practice, I centralize tracking in a single composable or service, so no component talks directly to ",[14,234,235],{},"gtag",":",[238,239,245],"pre",{"className":240,"code":241,"filename":242,"language":243,"meta":244,"style":244},"language-ts shiki shiki-themes material-theme-lighter github-light-default github-dark-default","export function useTracking() {\n  const consent = useConsent()\n\n  function track(event: TrackingEvent, params: Record\u003Cstring, string | number> = {}) {\n    \u002F\u002F Without consent for measurement, nothing leaves the browser\n    if (!consent.value.analytics) return\n    window.gtag?.('event', event, params)\n  }\n\n  return { track }\n}\n","composables\u002FuseTracking.ts","ts","",[14,246,247,271,292,299,360,367,399,435,441,446,460],{"__ignoreMap":244},[248,249,252,256,260,264,268],"span",{"class":250,"line":251},"line",1,[248,253,255],{"class":254},"sqgCv","export",[248,257,259],{"class":258},"s4vtu"," function",[248,261,263],{"class":262},"siEnl"," useTracking",[248,265,267],{"class":266},"sWneD","()",[248,269,270],{"class":266}," {\n",[248,272,274,277,281,285,288],{"class":250,"line":273},2,[248,275,276],{"class":258},"  const",[248,278,280],{"class":279},"sum78"," consent",[248,282,284],{"class":283},"s8eFF"," =",[248,286,287],{"class":262}," useConsent",[248,289,291],{"class":290},"sZ24s","()\n",[248,293,295],{"class":250,"line":294},3,[248,296,298],{"emptyLinePlaceholder":297},true,"\n",[248,300,302,305,308,311,315,317,321,324,327,329,332,335,339,341,344,347,350,353,355,358],{"class":250,"line":301},4,[248,303,304],{"class":258},"  function",[248,306,307],{"class":262}," track",[248,309,310],{"class":266},"(",[248,312,314],{"class":313},"sWFk-","event",[248,316,236],{"class":283},[248,318,320],{"class":319},"seIyd"," TrackingEvent",[248,322,323],{"class":266},",",[248,325,326],{"class":313}," params",[248,328,236],{"class":283},[248,330,331],{"class":319}," Record",[248,333,334],{"class":266},"\u003C",[248,336,338],{"class":337},"sHdwX","string",[248,340,323],{"class":266},[248,342,343],{"class":337}," string",[248,345,346],{"class":283}," |",[248,348,349],{"class":337}," number",[248,351,352],{"class":266},">",[248,354,284],{"class":283},[248,356,357],{"class":266}," {})",[248,359,270],{"class":266},[248,361,363],{"class":250,"line":362},5,[248,364,366],{"class":365},"siFmp","    \u002F\u002F Without consent for measurement, nothing leaves the browser\n",[248,368,370,373,376,379,383,385,388,390,393,396],{"class":250,"line":369},6,[248,371,372],{"class":254},"    if",[248,374,375],{"class":290}," (",[248,377,378],{"class":283},"!",[248,380,382],{"class":381},"saDVj","consent",[248,384,111],{"class":266},[248,386,387],{"class":381},"value",[248,389,111],{"class":266},[248,391,392],{"class":381},"analytics",[248,394,395],{"class":290},") ",[248,397,398],{"class":254},"return\n",[248,400,402,405,407,409,412,414,418,421,423,425,428,430,432],{"class":250,"line":401},7,[248,403,404],{"class":381},"    window",[248,406,111],{"class":266},[248,408,235],{"class":262},[248,410,411],{"class":266},"?.",[248,413,310],{"class":290},[248,415,417],{"class":416},"sX5mu","'",[248,419,314],{"class":420},"sasMN",[248,422,417],{"class":416},[248,424,323],{"class":266},[248,426,427],{"class":381}," event",[248,429,323],{"class":266},[248,431,326],{"class":381},[248,433,434],{"class":290},")\n",[248,436,438],{"class":250,"line":437},8,[248,439,440],{"class":266},"  }\n",[248,442,444],{"class":250,"line":443},9,[248,445,298],{"emptyLinePlaceholder":297},[248,447,449,452,455,457],{"class":250,"line":448},10,[248,450,451],{"class":254},"  return",[248,453,454],{"class":266}," {",[248,456,307],{"class":381},[248,458,459],{"class":266}," }\n",[248,461,463],{"class":250,"line":462},11,[248,464,465],{"class":266},"}\n",[10,467,468,469,472],{},"That gives you three things: a single place to respect consent, a type (",[14,470,471],{},"TrackingEvent",") that prevents made-up names and one point to switch tools in the future without hunting calls across the code.",[30,474,476],{"id":475},"consent-isnt-a-detail","Consent isn't a detail",[10,478,479],{},"Under the LGPD (and the GDPR, if you serve Europe), measurement and consent go together. The design I usually propose:",[70,481,482,488,498,505,508],{},[41,483,484,487],{},[26,485,486],{},"Necessary cookies"," always on (session, preferences);",[41,489,490,493,494,497],{},[26,491,492],{},"Measurement"," (GA4) and ",[26,495,496],{},"marketing"," (ad pixels) as separate categories, each with a defined legal basis and a recorded choice;",[41,499,500,501,504],{},"A ",[26,502,503],{},"clear banner",", with accept, decline and customize at the same level, no hidden button;",[41,506,507],{},"The choice stored in its own cookie and a permanent link in the footer to review preferences;",[41,509,500,510,513],{},[26,511,512],{},"cookie policy"," that says in plain language what is collected and why.",[515,516,517],"warning",{},[10,518,519],{},"The legal basis (consent or legitimate interest) and the default behavior vary by country and by case. It's a decision to make with whoever handles legal, not an implementation detail.",[30,521,523],{"id":522},"validate-before-you-trust","Validate before you trust",[10,525,526],{},"Before using a number to make a decision, check:",[70,528,529,536,543,546],{},[41,530,531,532,535],{},"Does the event show up in GA4's ",[26,533,534],{},"DebugView"," with the right parameters?",[41,537,538,539,542],{},"Are the important parameters registered as ",[26,540,541],{},"custom dimensions","?",[41,544,545],{},"Does the volume match another source (database, Stripe, CRM) within a reasonable order of magnitude?",[41,547,548,549,542],{},"Do people who declined consent really send ",[26,550,551],{},"nothing",[30,553,555],{"id":554},"summary","Summary",[10,557,558],{},"A good measurement plan fits on one page: the decisions, the questions, the event dictionary and the consent rules. It costs an afternoon at the start and saves months of data nobody trusts. And it has a nice side effect: it forces product, engineering and marketing to agree, before building, on what \"working\" means.",[560,561,562],"style",{},"html pre.shiki code .sqgCv, html code.shiki .sqgCv{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#CF222E;--shiki-default-font-style:inherit;--shiki-dark:#FF7B72;--shiki-dark-font-style:inherit}html pre.shiki code .s4vtu, html code.shiki .s4vtu{--shiki-light:#9C3EDA;--shiki-default:#CF222E;--shiki-dark:#FF7B72}html pre.shiki code .siEnl, html code.shiki .siEnl{--shiki-light:#6182B8;--shiki-default:#8250DF;--shiki-dark:#D2A8FF}html pre.shiki code .sWneD, html code.shiki .sWneD{--shiki-light:#39ADB5;--shiki-default:#1F2328;--shiki-dark:#E6EDF3}html pre.shiki code .sum78, html code.shiki .sum78{--shiki-light:#90A4AE;--shiki-default:#0550AE;--shiki-dark:#79C0FF}html pre.shiki code .s8eFF, html code.shiki .s8eFF{--shiki-light:#39ADB5;--shiki-default:#CF222E;--shiki-dark:#FF7B72}html pre.shiki code .sZ24s, html code.shiki .sZ24s{--shiki-light:#E53935;--shiki-default:#1F2328;--shiki-dark:#E6EDF3}html pre.shiki code .sWFk-, html code.shiki .sWFk-{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#953800;--shiki-default-font-style:inherit;--shiki-dark:#FFA657;--shiki-dark-font-style:inherit}html pre.shiki code .seIyd, html code.shiki .seIyd{--shiki-light:#E2931D;--shiki-default:#953800;--shiki-dark:#FFA657}html pre.shiki code .sHdwX, html code.shiki .sHdwX{--shiki-light:#E2931D;--shiki-default:#0550AE;--shiki-dark:#79C0FF}html pre.shiki code .siFmp, html code.shiki .siFmp{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6E7781;--shiki-default-font-style:inherit;--shiki-dark:#8B949E;--shiki-dark-font-style:inherit}html pre.shiki code .saDVj, html code.shiki .saDVj{--shiki-light:#90A4AE;--shiki-default:#1F2328;--shiki-dark:#E6EDF3}html pre.shiki code .sX5mu, html code.shiki .sX5mu{--shiki-light:#39ADB5;--shiki-default:#0A3069;--shiki-dark:#A5D6FF}html pre.shiki code .sasMN, html code.shiki .sasMN{--shiki-light:#91B859;--shiki-default:#0A3069;--shiki-dark:#A5D6FF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":244,"searchDepth":294,"depth":294,"links":564},[565,566,567,568,569,570],{"id":32,"depth":273,"text":33},{"id":64,"depth":273,"text":65},{"id":221,"depth":273,"text":222},{"id":475,"depth":273,"text":476},{"id":522,"depth":273,"text":523},{"id":554,"depth":273,"text":555},"2026-10-22","Installing GA4 takes five minutes; trusting the data takes months if you start wrong. How I design the event taxonomy, consent and measurement flow together with the feature.",false,"md",{},"\u002Fblog\u002Fmeasurement-plan-before-the-first-event","dados",{"title":5,"description":572},"blog\u002Fmeasurement-plan-before-the-first-event",[581,392,582,583,584],"ga4","privacy","events","measurement","plano-de-medicao-antes-do-primeiro-evento",null,"Ri3cbTCdAeJBjD-50Q0MCPMU3-uBs1Q1h2jiaRci60k",[589,599],{"title":590,"description":591,"path":592,"date":593,"segment":577,"category":594,"tags":595,"featured":573,"readingTime":294},"A North Star without vanity: how to choose the metric that really guides the product","Registered users, pageviews and downloads make pretty charts and bad decisions. A guide to choosing the metric that matters and building the tree that connects the team's work to it.","\u002Fblog\u002Fnorth-star-without-vanity","2026-10-29","metricas",[596,597,598,392],"metrics","north-star","product",{"title":600,"description":601,"path":602,"date":603,"segment":577,"category":604,"tags":605,"featured":573,"readingTime":294},"A\u002FB testing with little traffic: what to do when statistics won't help you","With a few visits a week, a classic A\u002FB test takes months to tell you anything. How to experiment honestly in small products, without false winners.","\u002Fblog\u002Fab-testing-with-little-traffic","2026-09-10","experimentacao",[606,607,608,609],"ab-test","experimentation","statistics","conversion",{"pt-br":611},"\u002Fpt-br\u002Fblog\u002Fplano-de-medicao-antes-do-primeiro-evento",[613,615],{"title":590,"path":592,"stem":614,"description":591,"children":-1},"blog\u002Fnorth-star-without-vanity",{"title":616,"path":617,"stem":618,"description":619,"children":-1},"Meta Ads or Google Ads? The right question is: does the demand already exist?","\u002Fblog\u002Fmeta-ads-or-google-ads","blog\u002Fmeta-ads-or-google-ads","Comparing ad platforms by cost per click is comparing tools built for different jobs. A more useful way to decide: capturing demand or creating demand.",1795021079770]