[{"data":1,"prerenderedAt":1374},["ShallowReactive",2],{"article-alternates":3,"article-\u002Ffr\u002Fmarketing\u002Fmeta-capi-server-side-conversion-tracking":12},{"i18nKey":4,"paths":5},"marketing-001-2026-05",{"de":6,"en":7,"es":8,"fr":9,"it":10,"ru":11},"\u002Fde\u002Fmarketing\u002Fmeta-capi-server-side-conversion-tracking","\u002Fen\u002Fmarketing\u002Fserver-side-conversions-setting-up-meta-capi-correctly","\u002Fes\u002Fmarketing\u002Fconversiones-lado-servidor-meta-capi-configuracion-correcta","\u002Ffr\u002Fmarketing\u002Fmeta-capi-server-side-conversion-tracking","\u002Fit\u002Fmarketing\u002Fserver-side-conversioni-meta-capi-correttamente-configurato","\u002Fru\u002Fmarketing\u002Fserver-side-conversions-meta-capi-sgtm",{"_path":9,"_dir":13,"_draft":14,"_partial":14,"_locale":15,"title":16,"description":17,"publishedAt":18,"modifiedAt":18,"category":13,"i18nKey":4,"tags":19,"readingTime":25,"author":26,"body":27,"_type":1368,"_id":1369,"_source":1370,"_file":1371,"_stem":1372,"_extension":1373},"marketing",false,"","Server-Side Conversions: Meta CAPI Correctly Set Up From Zero","How to build Meta CAPI + sGTM architecture after iOS 17 and cookie restrictions? Deduplication, event match quality, and attribution infrastructure.","2026-05-28",[20,21,22,23,24],"meta-capi","server-side-gtm","conversion-api","event-match-quality","attribution",8,"Roibase",{"type":28,"children":29,"toc":1357},"root",[30,38,45,50,55,60,66,71,76,131,136,143,148,153,353,365,371,376,543,562,567,637,642,648,669,674,910,922,1218,1223,1229,1234,1239,1253,1259,1271,1336,1341,1346,1351],{"type":31,"tag":32,"props":33,"children":34},"element","p",{},[35],{"type":36,"value":37},"text","App Tracking Transparency (ATT) acceptance on iOS 17.4 dropped to 12%. Third-party cookie support ended in Chrome Q3 2025. The \"Event Source\" column in Meta Ads Manager shows pixel contribution fell to 40%. These numbers don't suggest browser-based measurement is insufficient—they demonstrate that measurement itself demands an entirely new architecture. Server-side conversion tracking isn't optional at this point; it's mandatory. The combination of Meta Conversions API (CAPI) with server-side Google Tag Manager (sGTM) is the only infrastructure that minimizes signal loss to acceptable levels.",{"type":31,"tag":39,"props":40,"children":42},"h2",{"id":41},"where-browser-based-measurement-no-longer-works",[43],{"type":36,"value":44},"Where Browser-Based Measurement No Longer Works",{"type":31,"tag":32,"props":46,"children":47},{},[48],{"type":36,"value":49},"Meta pixel operates through client-side JavaScript. If a user exits the page before the pixel loads, the event disappears. Safari Intelligent Tracking Prevention (ITP) reduces cookie lifetime to 7 days. Ad blocker adoption sits at 42%. Under these conditions, what the pixel sees is 60–70% of actual conversions. The remaining 30–40% are \"phantom conversions\"—they happened, but Meta never heard about them.",{"type":31,"tag":32,"props":51,"children":52},{},[53],{"type":36,"value":54},"The attribution window has narrowed too. Pixel operates on 1-day click and 7-day view windows. Yet ITP can delete the cookie within 24 hours regardless. In industries with long sales cycles (B2B SaaS, finance, education), 80% of conversions arrive 7+ days later. The pixel sees none of them. Campaign ROAS looks like 1.2; reality is 2.8. Budget shifts to the wrong channel.",{"type":31,"tag":32,"props":56,"children":57},{},[58],{"type":36,"value":59},"Cross-device scenarios collapse entirely. A user sees the ad on mobile, purchases on desktop. Because the pixel reads different cookie domains, it counts them as two separate users. CAPI is sent from the server, carrying user hashes (email SHA-256, phone SHA-256). Both devices match as one person.",{"type":31,"tag":39,"props":61,"children":63},{"id":62},"how-capi-sgtm-infrastructure-works",[64],{"type":36,"value":65},"How CAPI + sGTM Infrastructure Works",{"type":31,"tag":32,"props":67,"children":68},{},[69],{"type":36,"value":70},"Server-side conversion tracking consists of two layers: a data collection layer (sGTM container) and an API transmission layer (CAPI endpoint). sGTM is a container deployed on Google Cloud Run. It receives events from client-side GTM, enriches them, and POSTs them to CAPI. Meta's server receives the data, applies deduplication, and feeds it into the attribution model.",{"type":31,"tag":32,"props":72,"children":73},{},[74],{"type":36,"value":75},"Data flows in this sequence:",{"type":31,"tag":77,"props":78,"children":79},"ol",{},[80,95,100,105,110,121,126],{"type":31,"tag":81,"props":82,"children":83},"li",{},[84,86,93],{"type":36,"value":85},"Client-side GTM fires a ",{"type":31,"tag":87,"props":88,"children":90},"code",{"className":89},[],[91],{"type":36,"value":92},"purchase",{"type":36,"value":94}," event (dataLayer push)",{"type":31,"tag":81,"props":96,"children":97},{},[98],{"type":36,"value":99},"Event is sent to sGTM container URL as an HTTP POST",{"type":31,"tag":81,"props":101,"children":102},{},[103],{"type":36,"value":104},"The \"Meta Conversions API\" tag inside sGTM reads event parameters",{"type":31,"tag":81,"props":106,"children":107},{},[108],{"type":36,"value":109},"Adds server IP, user-agent, event_time, external_id (hashed email)",{"type":31,"tag":81,"props":111,"children":112},{},[113,115],{"type":36,"value":114},"POSTs to CAPI endpoint: ",{"type":31,"tag":87,"props":116,"children":118},{"className":117},[],[119],{"type":36,"value":120},"https:\u002F\u002Fgraph.facebook.com\u002Fv19.0\u002F{pixel_id}\u002Fevents",{"type":31,"tag":81,"props":122,"children":123},{},[124],{"type":36,"value":125},"Meta deduplication algorithm merges pixel + server events",{"type":31,"tag":81,"props":127,"children":128},{},[129],{"type":36,"value":130},"If within attribution window, conversion is assigned to campaign",{"type":31,"tag":32,"props":132,"children":133},{},[134],{"type":36,"value":135},"sGTM's critical advantage: the client-side event and server-side event carry the same event_id. When Meta sees this ID, it collapses both events (deduplication). If pixel event arrives and within 5 minutes a server event arrives with the same event_id, Meta counts one conversion. This prevents double counting.",{"type":31,"tag":137,"props":138,"children":140},"h3",{"id":139},"how-event-match-quality-score-increases",[141],{"type":36,"value":142},"How Event Match Quality Score Increases",{"type":31,"tag":32,"props":144,"children":145},{},[146],{"type":36,"value":147},"Meta's Event Match Quality (EMQ) score ranges 0–10. It indicates how usable the event parameters are for attribution. Pixel typically scores 2.5–4.5. With CAPI it climbs to 7.5–9.5. Higher scores accelerate campaign learning phase and reduce CPA by 15–30%.",{"type":31,"tag":32,"props":149,"children":150},{},[151],{"type":36,"value":152},"Parameters that raise EMQ score:",{"type":31,"tag":154,"props":155,"children":156},"table",{},[157,186],{"type":31,"tag":158,"props":159,"children":160},"thead",{},[161],{"type":31,"tag":162,"props":163,"children":164},"tr",{},[165,171,176,181],{"type":31,"tag":166,"props":167,"children":168},"th",{},[169],{"type":36,"value":170},"Parameter",{"type":31,"tag":166,"props":172,"children":173},{},[174],{"type":36,"value":175},"Pixel provides?",{"type":31,"tag":166,"props":177,"children":178},{},[179],{"type":36,"value":180},"Server provides?",{"type":31,"tag":166,"props":182,"children":183},{},[184],{"type":36,"value":185},"Weight",{"type":31,"tag":187,"props":188,"children":189},"tbody",{},[190,220,249,275,301,328],{"type":31,"tag":162,"props":191,"children":192},{},[193,205,210,215],{"type":31,"tag":194,"props":195,"children":196},"td",{},[197,203],{"type":31,"tag":87,"props":198,"children":200},{"className":199},[],[201],{"type":36,"value":202},"external_id",{"type":36,"value":204}," (hashed email)",{"type":31,"tag":194,"props":206,"children":207},{},[208],{"type":36,"value":209},"❌",{"type":31,"tag":194,"props":211,"children":212},{},[213],{"type":36,"value":214},"✅",{"type":31,"tag":194,"props":216,"children":217},{},[218],{"type":36,"value":219},"High",{"type":31,"tag":162,"props":221,"children":222},{},[223,234,239,244],{"type":31,"tag":194,"props":224,"children":225},{},[226,232],{"type":31,"tag":87,"props":227,"children":229},{"className":228},[],[230],{"type":36,"value":231},"client_user_agent",{"type":36,"value":233}," (full)",{"type":31,"tag":194,"props":235,"children":236},{},[237],{"type":36,"value":238},"✅ (limited)",{"type":31,"tag":194,"props":240,"children":241},{},[242],{"type":36,"value":243},"✅ (full)",{"type":31,"tag":194,"props":245,"children":246},{},[247],{"type":36,"value":248},"Medium",{"type":31,"tag":162,"props":250,"children":251},{},[252,261,266,271],{"type":31,"tag":194,"props":253,"children":254},{},[255],{"type":31,"tag":87,"props":256,"children":258},{"className":257},[],[259],{"type":36,"value":260},"client_ip_address",{"type":31,"tag":194,"props":262,"children":263},{},[264],{"type":36,"value":265},"❌ (proxy)",{"type":31,"tag":194,"props":267,"children":268},{},[269],{"type":36,"value":270},"✅ (real)",{"type":31,"tag":194,"props":272,"children":273},{},[274],{"type":36,"value":219},{"type":31,"tag":162,"props":276,"children":277},{},[278,289,293,297],{"type":31,"tag":194,"props":279,"children":280},{},[281,287],{"type":31,"tag":87,"props":282,"children":284},{"className":283},[],[285],{"type":36,"value":286},"fbc",{"type":36,"value":288}," (click ID)",{"type":31,"tag":194,"props":290,"children":291},{},[292],{"type":36,"value":214},{"type":31,"tag":194,"props":294,"children":295},{},[296],{"type":36,"value":214},{"type":31,"tag":194,"props":298,"children":299},{},[300],{"type":36,"value":219},{"type":31,"tag":162,"props":302,"children":303},{},[304,315,319,324],{"type":31,"tag":194,"props":305,"children":306},{},[307,313],{"type":31,"tag":87,"props":308,"children":310},{"className":309},[],[311],{"type":36,"value":312},"fbp",{"type":36,"value":314}," (browser ID)",{"type":31,"tag":194,"props":316,"children":317},{},[318],{"type":36,"value":214},{"type":31,"tag":194,"props":320,"children":321},{},[322],{"type":36,"value":323},"✅ (forwarded)",{"type":31,"tag":194,"props":325,"children":326},{},[327],{"type":36,"value":248},{"type":31,"tag":162,"props":329,"children":330},{},[331,340,344,348],{"type":31,"tag":194,"props":332,"children":333},{},[334],{"type":31,"tag":87,"props":335,"children":337},{"className":336},[],[338],{"type":36,"value":339},"event_source_url",{"type":31,"tag":194,"props":341,"children":342},{},[343],{"type":36,"value":214},{"type":31,"tag":194,"props":345,"children":346},{},[347],{"type":36,"value":214},{"type":31,"tag":194,"props":349,"children":350},{},[351],{"type":36,"value":352},"Low",{"type":31,"tag":32,"props":354,"children":355},{},[356,358,363],{"type":36,"value":357},"The most critical parameter pixel cannot send is ",{"type":31,"tag":87,"props":359,"children":361},{"className":360},[],[362],{"type":36,"value":202},{"type":36,"value":364},". After email consent is obtained from the user via a GDPR\u002FCCPA-compliant consent management platform (CMP), the backend hashes that email SHA-256 and sends it to sGTM. Meta matches this hash against its own user graph. Match rate sits around 60–80% (depends on email accuracy). For matched users, attribution reliability jumps to 95%.",{"type":31,"tag":39,"props":366,"children":368},{"id":367},"architecture-setup-sgtm-container-deployment-and-capi-configuration",[369],{"type":36,"value":370},"Architecture Setup: sGTM Container Deployment and CAPI Configuration",{"type":31,"tag":32,"props":372,"children":373},{},[374],{"type":36,"value":375},"To deploy sGTM container on Google Cloud Run, first create a \"Server\" container type in GTM. Once you have the container ID (GTM-XXXXXX), deploy on Cloud Run:",{"type":31,"tag":377,"props":378,"children":382},"pre",{"className":379,"code":380,"language":381,"meta":15,"style":15},"language-bash shiki shiki-themes github-dark","gcloud run deploy sgtm-roibase \\\n  --image=gcr.io\u002Fcloud-tagging-10302018\u002Fgtm-cloud-image:stable \\\n  --platform=managed \\\n  --region=europe-west1 \\\n  --set-env-vars=CONTAINER_CONFIG={container_id} \\\n  --allow-unauthenticated \\\n  --min-instances=1 \\\n  --max-instances=10 \\\n  --cpu=1 \\\n  --memory=512Mi\n","bash",[383],{"type":31,"tag":87,"props":384,"children":385},{"__ignoreMap":15},[386,420,433,446,459,483,496,509,521,534],{"type":31,"tag":387,"props":388,"children":391},"span",{"class":389,"line":390},"line",1,[392,398,404,409,414],{"type":31,"tag":387,"props":393,"children":395},{"style":394},"--shiki-default:#B392F0",[396],{"type":36,"value":397},"gcloud",{"type":31,"tag":387,"props":399,"children":401},{"style":400},"--shiki-default:#9ECBFF",[402],{"type":36,"value":403}," run",{"type":31,"tag":387,"props":405,"children":406},{"style":400},[407],{"type":36,"value":408}," deploy",{"type":31,"tag":387,"props":410,"children":411},{"style":400},[412],{"type":36,"value":413}," sgtm-roibase",{"type":31,"tag":387,"props":415,"children":417},{"style":416},"--shiki-default:#79B8FF",[418],{"type":36,"value":419}," \\\n",{"type":31,"tag":387,"props":421,"children":423},{"class":389,"line":422},2,[424,429],{"type":31,"tag":387,"props":425,"children":426},{"style":416},[427],{"type":36,"value":428},"  --image=gcr.io\u002Fcloud-tagging-10302018\u002Fgtm-cloud-image:stable",{"type":31,"tag":387,"props":430,"children":431},{"style":416},[432],{"type":36,"value":419},{"type":31,"tag":387,"props":434,"children":436},{"class":389,"line":435},3,[437,442],{"type":31,"tag":387,"props":438,"children":439},{"style":416},[440],{"type":36,"value":441},"  --platform=managed",{"type":31,"tag":387,"props":443,"children":444},{"style":416},[445],{"type":36,"value":419},{"type":31,"tag":387,"props":447,"children":449},{"class":389,"line":448},4,[450,455],{"type":31,"tag":387,"props":451,"children":452},{"style":416},[453],{"type":36,"value":454},"  --region=europe-west1",{"type":31,"tag":387,"props":456,"children":457},{"style":416},[458],{"type":36,"value":419},{"type":31,"tag":387,"props":460,"children":462},{"class":389,"line":461},5,[463,468,474,479],{"type":31,"tag":387,"props":464,"children":465},{"style":416},[466],{"type":36,"value":467},"  --set-env-vars=CONTAINER_CONFIG=",{"type":31,"tag":387,"props":469,"children":471},{"style":470},"--shiki-default:#E1E4E8",[472],{"type":36,"value":473},"{",{"type":31,"tag":387,"props":475,"children":476},{"style":394},[477],{"type":36,"value":478},"container_id}",{"type":31,"tag":387,"props":480,"children":481},{"style":416},[482],{"type":36,"value":419},{"type":31,"tag":387,"props":484,"children":486},{"class":389,"line":485},6,[487,492],{"type":31,"tag":387,"props":488,"children":489},{"style":416},[490],{"type":36,"value":491},"  --allow-unauthenticated",{"type":31,"tag":387,"props":493,"children":494},{"style":416},[495],{"type":36,"value":419},{"type":31,"tag":387,"props":497,"children":499},{"class":389,"line":498},7,[500,505],{"type":31,"tag":387,"props":501,"children":502},{"style":416},[503],{"type":36,"value":504},"  --min-instances=1",{"type":31,"tag":387,"props":506,"children":507},{"style":416},[508],{"type":36,"value":419},{"type":31,"tag":387,"props":510,"children":511},{"class":389,"line":25},[512,517],{"type":31,"tag":387,"props":513,"children":514},{"style":416},[515],{"type":36,"value":516},"  --max-instances=10",{"type":31,"tag":387,"props":518,"children":519},{"style":416},[520],{"type":36,"value":419},{"type":31,"tag":387,"props":522,"children":524},{"class":389,"line":523},9,[525,530],{"type":31,"tag":387,"props":526,"children":527},{"style":416},[528],{"type":36,"value":529},"  --cpu=1",{"type":31,"tag":387,"props":531,"children":532},{"style":416},[533],{"type":36,"value":419},{"type":31,"tag":387,"props":535,"children":537},{"class":389,"line":536},10,[538],{"type":31,"tag":387,"props":539,"children":540},{"style":416},[541],{"type":36,"value":542},"  --memory=512Mi\n",{"type":31,"tag":32,"props":544,"children":545},{},[546,552,554,560],{"type":31,"tag":87,"props":547,"children":549},{"className":548},[],[550],{"type":36,"value":551},"--min-instances=1",{"type":36,"value":553}," is critical: it prevents cold starts. First event processes in 50ms instead of 300ms. Once the container is deployed, set a custom domain in GTM: ",{"type":31,"tag":87,"props":555,"children":557},{"className":556},[],[558],{"type":36,"value":559},"sgtm.roibase.com.tr",{"type":36,"value":561},". Add a CNAME in Cloudflare DNS; SSL certificate renews automatically.",{"type":31,"tag":32,"props":563,"children":564},{},[565],{"type":36,"value":566},"In client-side GTM, under \"Google Tag: GA4\" settings, enable \"Send to server container\" and enter the container URL. Every GA4 event now flows to sGTM automatically. Inside sGTM, add a \"Meta Conversions API\" tag:",{"type":31,"tag":568,"props":569,"children":570},"ul",{},[571,582,592,617,627],{"type":31,"tag":81,"props":572,"children":573},{},[574,580],{"type":31,"tag":575,"props":576,"children":577},"strong",{},[578],{"type":36,"value":579},"Pixel ID:",{"type":36,"value":581}," 15-digit ID from Meta Ads Manager",{"type":31,"tag":81,"props":583,"children":584},{},[585,590],{"type":31,"tag":575,"props":586,"children":587},{},[588],{"type":36,"value":589},"Access Token:",{"type":36,"value":591}," Events Manager > Settings > Generate Access Token (as system user)",{"type":31,"tag":81,"props":593,"children":594},{},[595,600,602,607,609,615],{"type":31,"tag":575,"props":596,"children":597},{},[598],{"type":36,"value":599},"Event Name:",{"type":36,"value":601}," Event name from GA4 (",{"type":31,"tag":87,"props":603,"children":605},{"className":604},[],[606],{"type":36,"value":92},{"type":36,"value":608},", ",{"type":31,"tag":87,"props":610,"children":612},{"className":611},[],[613],{"type":36,"value":614},"add_to_cart",{"type":36,"value":616},", etc.)",{"type":31,"tag":81,"props":618,"children":619},{},[620,625],{"type":31,"tag":575,"props":621,"children":622},{},[623],{"type":36,"value":624},"Event ID:",{"type":36,"value":626}," Same ID as client-side (for deduplication)",{"type":31,"tag":81,"props":628,"children":629},{},[630,635],{"type":31,"tag":575,"props":631,"children":632},{},[633],{"type":36,"value":634},"Test Event Code:",{"type":36,"value":636}," See test events in Meta's test dashboard before going live",{"type":31,"tag":32,"props":638,"children":639},{},[640],{"type":36,"value":641},"Access token has no expiration (if using system user token). If compromised, revoke instantly. Store the token as an environment variable in sGTM, never hardcode it.",{"type":31,"tag":137,"props":643,"children":645},{"id":644},"deduplication-strategy-and-event-id-management",[646],{"type":36,"value":647},"Deduplication Strategy and Event ID Management",{"type":31,"tag":32,"props":649,"children":650},{},[651,653,659,661,667],{"type":36,"value":652},"Deduplication prevents pixel and server events from double-counting. Meta's algorithm works like this: if the same ",{"type":31,"tag":87,"props":654,"children":656},{"className":655},[],[657],{"type":36,"value":658},"event_id",{"type":36,"value":660}," and ",{"type":31,"tag":87,"props":662,"children":664},{"className":663},[],[665],{"type":36,"value":666},"event_name",{"type":36,"value":668}," arrive within 5 minutes, only the one with the higher EMQ score counts. Usually that's the server event. But if pixel event arrived 1 second earlier and server event arrives 6 minutes later, both count separately.",{"type":31,"tag":32,"props":670,"children":671},{},[672],{"type":36,"value":673},"Generate client-side event_id this way:",{"type":31,"tag":377,"props":675,"children":679},{"className":676,"code":677,"language":678,"meta":15,"style":15},"language-javascript shiki shiki-themes github-dark","\u002F\u002F Before dataLayer push\nconst eventId = Date.now().toString() + Math.random().toString(36).substring(2, 9);\nwindow.dataLayer.push({\n  event: 'purchase',\n  transaction_id: '12345',\n  value: 99.99,\n  currency: 'TRY',\n  event_id: eventId \u002F\u002F same ID sent to server\n});\n","javascript",[680],{"type":31,"tag":87,"props":681,"children":682},{"__ignoreMap":15},[683,692,802,820,838,855,872,889,902],{"type":31,"tag":387,"props":684,"children":685},{"class":389,"line":390},[686],{"type":31,"tag":387,"props":687,"children":689},{"style":688},"--shiki-default:#6A737D",[690],{"type":36,"value":691},"\u002F\u002F Before dataLayer push\n",{"type":31,"tag":387,"props":693,"children":694},{"class":389,"line":422},[695,701,706,711,716,721,726,731,736,741,746,751,755,759,764,769,774,779,783,788,792,797],{"type":31,"tag":387,"props":696,"children":698},{"style":697},"--shiki-default:#F97583",[699],{"type":36,"value":700},"const",{"type":31,"tag":387,"props":702,"children":703},{"style":416},[704],{"type":36,"value":705}," eventId",{"type":31,"tag":387,"props":707,"children":708},{"style":697},[709],{"type":36,"value":710}," =",{"type":31,"tag":387,"props":712,"children":713},{"style":470},[714],{"type":36,"value":715}," Date.",{"type":31,"tag":387,"props":717,"children":718},{"style":394},[719],{"type":36,"value":720},"now",{"type":31,"tag":387,"props":722,"children":723},{"style":470},[724],{"type":36,"value":725},"().",{"type":31,"tag":387,"props":727,"children":728},{"style":394},[729],{"type":36,"value":730},"toString",{"type":31,"tag":387,"props":732,"children":733},{"style":470},[734],{"type":36,"value":735},"() ",{"type":31,"tag":387,"props":737,"children":738},{"style":697},[739],{"type":36,"value":740},"+",{"type":31,"tag":387,"props":742,"children":743},{"style":470},[744],{"type":36,"value":745}," Math.",{"type":31,"tag":387,"props":747,"children":748},{"style":394},[749],{"type":36,"value":750},"random",{"type":31,"tag":387,"props":752,"children":753},{"style":470},[754],{"type":36,"value":725},{"type":31,"tag":387,"props":756,"children":757},{"style":394},[758],{"type":36,"value":730},{"type":31,"tag":387,"props":760,"children":761},{"style":470},[762],{"type":36,"value":763},"(",{"type":31,"tag":387,"props":765,"children":766},{"style":416},[767],{"type":36,"value":768},"36",{"type":31,"tag":387,"props":770,"children":771},{"style":470},[772],{"type":36,"value":773},").",{"type":31,"tag":387,"props":775,"children":776},{"style":394},[777],{"type":36,"value":778},"substring",{"type":31,"tag":387,"props":780,"children":781},{"style":470},[782],{"type":36,"value":763},{"type":31,"tag":387,"props":784,"children":785},{"style":416},[786],{"type":36,"value":787},"2",{"type":31,"tag":387,"props":789,"children":790},{"style":470},[791],{"type":36,"value":608},{"type":31,"tag":387,"props":793,"children":794},{"style":416},[795],{"type":36,"value":796},"9",{"type":31,"tag":387,"props":798,"children":799},{"style":470},[800],{"type":36,"value":801},");\n",{"type":31,"tag":387,"props":803,"children":804},{"class":389,"line":435},[805,810,815],{"type":31,"tag":387,"props":806,"children":807},{"style":470},[808],{"type":36,"value":809},"window.dataLayer.",{"type":31,"tag":387,"props":811,"children":812},{"style":394},[813],{"type":36,"value":814},"push",{"type":31,"tag":387,"props":816,"children":817},{"style":470},[818],{"type":36,"value":819},"({\n",{"type":31,"tag":387,"props":821,"children":822},{"class":389,"line":448},[823,828,833],{"type":31,"tag":387,"props":824,"children":825},{"style":470},[826],{"type":36,"value":827},"  event: ",{"type":31,"tag":387,"props":829,"children":830},{"style":400},[831],{"type":36,"value":832},"'purchase'",{"type":31,"tag":387,"props":834,"children":835},{"style":470},[836],{"type":36,"value":837},",\n",{"type":31,"tag":387,"props":839,"children":840},{"class":389,"line":461},[841,846,851],{"type":31,"tag":387,"props":842,"children":843},{"style":470},[844],{"type":36,"value":845},"  transaction_id: ",{"type":31,"tag":387,"props":847,"children":848},{"style":400},[849],{"type":36,"value":850},"'12345'",{"type":31,"tag":387,"props":852,"children":853},{"style":470},[854],{"type":36,"value":837},{"type":31,"tag":387,"props":856,"children":857},{"class":389,"line":485},[858,863,868],{"type":31,"tag":387,"props":859,"children":860},{"style":470},[861],{"type":36,"value":862},"  value: ",{"type":31,"tag":387,"props":864,"children":865},{"style":416},[866],{"type":36,"value":867},"99.99",{"type":31,"tag":387,"props":869,"children":870},{"style":470},[871],{"type":36,"value":837},{"type":31,"tag":387,"props":873,"children":874},{"class":389,"line":498},[875,880,885],{"type":31,"tag":387,"props":876,"children":877},{"style":470},[878],{"type":36,"value":879},"  currency: ",{"type":31,"tag":387,"props":881,"children":882},{"style":400},[883],{"type":36,"value":884},"'TRY'",{"type":31,"tag":387,"props":886,"children":887},{"style":470},[888],{"type":36,"value":837},{"type":31,"tag":387,"props":890,"children":891},{"class":389,"line":25},[892,897],{"type":31,"tag":387,"props":893,"children":894},{"style":470},[895],{"type":36,"value":896},"  event_id: eventId ",{"type":31,"tag":387,"props":898,"children":899},{"style":688},[900],{"type":36,"value":901},"\u002F\u002F same ID sent to server\n",{"type":31,"tag":387,"props":903,"children":904},{"class":389,"line":523},[905],{"type":31,"tag":387,"props":906,"children":907},{"style":470},[908],{"type":36,"value":909},"});\n",{"type":31,"tag":32,"props":911,"children":912},{},[913,915,920],{"type":36,"value":914},"On the sGTM side, this ",{"type":31,"tag":87,"props":916,"children":918},{"className":917},[],[919],{"type":36,"value":658},{"type":36,"value":921}," parameter goes into the CAPI payload:",{"type":31,"tag":377,"props":923,"children":927},{"className":924,"code":925,"language":926,"meta":15,"style":15},"language-json shiki shiki-themes github-dark","{\n  \"data\": [{\n    \"event_name\": \"Purchase\",\n    \"event_time\": 1748448000,\n    \"event_id\": \"1748448000abc123\",\n    \"event_source_url\": \"https:\u002F\u002Fwww.roibase.com.tr\u002Fcheckout\",\n    \"user_data\": {\n      \"external_id\": [\"7d8a...\"], \n      \"client_ip_address\": \"85.34.x.x\",\n      \"client_user_agent\": \"Mozilla\u002F5.0...\"\n    },\n    \"custom_data\": {\n      \"currency\": \"TRY\",\n      \"value\": 99.99\n    }\n  }],\n  \"test_event_code\": \"TEST12345\"\n}\n","json",[928],{"type":31,"tag":87,"props":929,"children":930},{"__ignoreMap":15},[931,939,952,974,995,1016,1037,1050,1073,1094,1111,1120,1133,1155,1173,1182,1191,1209],{"type":31,"tag":387,"props":932,"children":933},{"class":389,"line":390},[934],{"type":31,"tag":387,"props":935,"children":936},{"style":470},[937],{"type":36,"value":938},"{\n",{"type":31,"tag":387,"props":940,"children":941},{"class":389,"line":422},[942,947],{"type":31,"tag":387,"props":943,"children":944},{"style":416},[945],{"type":36,"value":946},"  \"data\"",{"type":31,"tag":387,"props":948,"children":949},{"style":470},[950],{"type":36,"value":951},": [{\n",{"type":31,"tag":387,"props":953,"children":954},{"class":389,"line":435},[955,960,965,970],{"type":31,"tag":387,"props":956,"children":957},{"style":416},[958],{"type":36,"value":959},"    \"event_name\"",{"type":31,"tag":387,"props":961,"children":962},{"style":470},[963],{"type":36,"value":964},": ",{"type":31,"tag":387,"props":966,"children":967},{"style":400},[968],{"type":36,"value":969},"\"Purchase\"",{"type":31,"tag":387,"props":971,"children":972},{"style":470},[973],{"type":36,"value":837},{"type":31,"tag":387,"props":975,"children":976},{"class":389,"line":448},[977,982,986,991],{"type":31,"tag":387,"props":978,"children":979},{"style":416},[980],{"type":36,"value":981},"    \"event_time\"",{"type":31,"tag":387,"props":983,"children":984},{"style":470},[985],{"type":36,"value":964},{"type":31,"tag":387,"props":987,"children":988},{"style":416},[989],{"type":36,"value":990},"1748448000",{"type":31,"tag":387,"props":992,"children":993},{"style":470},[994],{"type":36,"value":837},{"type":31,"tag":387,"props":996,"children":997},{"class":389,"line":461},[998,1003,1007,1012],{"type":31,"tag":387,"props":999,"children":1000},{"style":416},[1001],{"type":36,"value":1002},"    \"event_id\"",{"type":31,"tag":387,"props":1004,"children":1005},{"style":470},[1006],{"type":36,"value":964},{"type":31,"tag":387,"props":1008,"children":1009},{"style":400},[1010],{"type":36,"value":1011},"\"1748448000abc123\"",{"type":31,"tag":387,"props":1013,"children":1014},{"style":470},[1015],{"type":36,"value":837},{"type":31,"tag":387,"props":1017,"children":1018},{"class":389,"line":485},[1019,1024,1028,1033],{"type":31,"tag":387,"props":1020,"children":1021},{"style":416},[1022],{"type":36,"value":1023},"    \"event_source_url\"",{"type":31,"tag":387,"props":1025,"children":1026},{"style":470},[1027],{"type":36,"value":964},{"type":31,"tag":387,"props":1029,"children":1030},{"style":400},[1031],{"type":36,"value":1032},"\"https:\u002F\u002Fwww.roibase.com.tr\u002Fcheckout\"",{"type":31,"tag":387,"props":1034,"children":1035},{"style":470},[1036],{"type":36,"value":837},{"type":31,"tag":387,"props":1038,"children":1039},{"class":389,"line":498},[1040,1045],{"type":31,"tag":387,"props":1041,"children":1042},{"style":416},[1043],{"type":36,"value":1044},"    \"user_data\"",{"type":31,"tag":387,"props":1046,"children":1047},{"style":470},[1048],{"type":36,"value":1049},": {\n",{"type":31,"tag":387,"props":1051,"children":1052},{"class":389,"line":25},[1053,1058,1063,1068],{"type":31,"tag":387,"props":1054,"children":1055},{"style":416},[1056],{"type":36,"value":1057},"      \"external_id\"",{"type":31,"tag":387,"props":1059,"children":1060},{"style":470},[1061],{"type":36,"value":1062},": [",{"type":31,"tag":387,"props":1064,"children":1065},{"style":400},[1066],{"type":36,"value":1067},"\"7d8a...\"",{"type":31,"tag":387,"props":1069,"children":1070},{"style":470},[1071],{"type":36,"value":1072},"], \n",{"type":31,"tag":387,"props":1074,"children":1075},{"class":389,"line":523},[1076,1081,1085,1090],{"type":31,"tag":387,"props":1077,"children":1078},{"style":416},[1079],{"type":36,"value":1080},"      \"client_ip_address\"",{"type":31,"tag":387,"props":1082,"children":1083},{"style":470},[1084],{"type":36,"value":964},{"type":31,"tag":387,"props":1086,"children":1087},{"style":400},[1088],{"type":36,"value":1089},"\"85.34.x.x\"",{"type":31,"tag":387,"props":1091,"children":1092},{"style":470},[1093],{"type":36,"value":837},{"type":31,"tag":387,"props":1095,"children":1096},{"class":389,"line":536},[1097,1102,1106],{"type":31,"tag":387,"props":1098,"children":1099},{"style":416},[1100],{"type":36,"value":1101},"      \"client_user_agent\"",{"type":31,"tag":387,"props":1103,"children":1104},{"style":470},[1105],{"type":36,"value":964},{"type":31,"tag":387,"props":1107,"children":1108},{"style":400},[1109],{"type":36,"value":1110},"\"Mozilla\u002F5.0...\"\n",{"type":31,"tag":387,"props":1112,"children":1114},{"class":389,"line":1113},11,[1115],{"type":31,"tag":387,"props":1116,"children":1117},{"style":470},[1118],{"type":36,"value":1119},"    },\n",{"type":31,"tag":387,"props":1121,"children":1123},{"class":389,"line":1122},12,[1124,1129],{"type":31,"tag":387,"props":1125,"children":1126},{"style":416},[1127],{"type":36,"value":1128},"    \"custom_data\"",{"type":31,"tag":387,"props":1130,"children":1131},{"style":470},[1132],{"type":36,"value":1049},{"type":31,"tag":387,"props":1134,"children":1136},{"class":389,"line":1135},13,[1137,1142,1146,1151],{"type":31,"tag":387,"props":1138,"children":1139},{"style":416},[1140],{"type":36,"value":1141},"      \"currency\"",{"type":31,"tag":387,"props":1143,"children":1144},{"style":470},[1145],{"type":36,"value":964},{"type":31,"tag":387,"props":1147,"children":1148},{"style":400},[1149],{"type":36,"value":1150},"\"TRY\"",{"type":31,"tag":387,"props":1152,"children":1153},{"style":470},[1154],{"type":36,"value":837},{"type":31,"tag":387,"props":1156,"children":1158},{"class":389,"line":1157},14,[1159,1164,1168],{"type":31,"tag":387,"props":1160,"children":1161},{"style":416},[1162],{"type":36,"value":1163},"      \"value\"",{"type":31,"tag":387,"props":1165,"children":1166},{"style":470},[1167],{"type":36,"value":964},{"type":31,"tag":387,"props":1169,"children":1170},{"style":416},[1171],{"type":36,"value":1172},"99.99\n",{"type":31,"tag":387,"props":1174,"children":1176},{"class":389,"line":1175},15,[1177],{"type":31,"tag":387,"props":1178,"children":1179},{"style":470},[1180],{"type":36,"value":1181},"    }\n",{"type":31,"tag":387,"props":1183,"children":1185},{"class":389,"line":1184},16,[1186],{"type":31,"tag":387,"props":1187,"children":1188},{"style":470},[1189],{"type":36,"value":1190},"  }],\n",{"type":31,"tag":387,"props":1192,"children":1194},{"class":389,"line":1193},17,[1195,1200,1204],{"type":31,"tag":387,"props":1196,"children":1197},{"style":416},[1198],{"type":36,"value":1199},"  \"test_event_code\"",{"type":31,"tag":387,"props":1201,"children":1202},{"style":470},[1203],{"type":36,"value":964},{"type":31,"tag":387,"props":1205,"children":1206},{"style":400},[1207],{"type":36,"value":1208},"\"TEST12345\"\n",{"type":31,"tag":387,"props":1210,"children":1212},{"class":389,"line":1211},18,[1213],{"type":31,"tag":387,"props":1214,"children":1215},{"style":470},[1216],{"type":36,"value":1217},"}\n",{"type":31,"tag":32,"props":1219,"children":1220},{},[1221],{"type":36,"value":1222},"Remove test event code before going live. In production, incoming events appear in Meta Events Manager > Data Sources > {pixel_id} > Events within 10 seconds. EMQ score updates in real-time on the same page.",{"type":31,"tag":39,"props":1224,"children":1226},{"id":1225},"attribution-window-and-incrementality-testing",[1227],{"type":36,"value":1228},"Attribution Window and Incrementality Testing",{"type":31,"tag":32,"props":1230,"children":1231},{},[1232],{"type":36,"value":1233},"CAPI extends the attribution window. While pixel is limited to 7-day click \u002F 1-day view, CAPI supports 28-day click \u002F 1-day view. For iOS users, however, SKAdNetwork attribution window is 0-day (if ATT rejected) or 3-day (if ATT accepted). CAPI cannot override this—it's a platform-level constraint.",{"type":31,"tag":32,"props":1235,"children":1236},{},[1237],{"type":36,"value":1238},"Test attribution reliability with geo-based holdout testing. Select 10 Turkish cities: enable CAPI in 5, run pixel-only in 5. After 4 weeks, measure conversion difference between groups. CAPI group shows 22–35% higher conversions (because signal loss is lower). This difference isn't incrementality—just measurement difference. For true incrementality, run Meta Conversion Lift test: pause campaign entirely and measure organic conversions.",{"type":31,"tag":32,"props":1240,"children":1241},{},[1242,1251],{"type":31,"tag":1243,"props":1244,"children":1248},"a",{"href":1245,"rel":1246},"https:\u002F\u002Fwww.roibase.com.tr\u002Ffr\u002Fppc",[1247],"nofollow",[1249],{"type":36,"value":1250},"Performance marketing (PPC)",{"type":36,"value":1252}," strategies are built on CAPI infrastructure. When the bidding algorithm sees server-side conversions, campaign budget optimization (CBO) learns faster. Learning phase drops from 5–7 days to 2–3 days.",{"type":31,"tag":39,"props":1254,"children":1256},{"id":1255},"common-mistakes-and-security-layer",[1257],{"type":36,"value":1258},"Common Mistakes and Security Layer",{"type":31,"tag":32,"props":1260,"children":1261},{},[1262,1264,1269],{"type":36,"value":1263},"Most frequent error: client-side and server-side event_ids don't match. Meta counts two conversions instead of one, ROAS inflates. Second mistake: sending plain-text email in the ",{"type":31,"tag":87,"props":1265,"children":1267},{"className":1266},[],[1268],{"type":36,"value":202},{"type":36,"value":1270}," parameter. That's GDPR noncompliance and Meta rejects the event. The hash algorithm must be SHA-256; email must be lowercase and trimmed:",{"type":31,"tag":377,"props":1272,"children":1276},{"className":1273,"code":1274,"language":1275,"meta":15,"style":15},"language-python shiki shiki-themes github-dark","import hashlib\nemail = \"user@example.com\"\nhashed = hashlib.sha256(email.strip().lower().encode()).hexdigest()\n# Returns 64-character hash like 7d8a3c2e1f...\n","python",[1277],{"type":31,"tag":87,"props":1278,"children":1279},{"__ignoreMap":15},[1280,1293,1311,1328],{"type":31,"tag":387,"props":1281,"children":1282},{"class":389,"line":390},[1283,1288],{"type":31,"tag":387,"props":1284,"children":1285},{"style":697},[1286],{"type":36,"value":1287},"import",{"type":31,"tag":387,"props":1289,"children":1290},{"style":470},[1291],{"type":36,"value":1292}," hashlib\n",{"type":31,"tag":387,"props":1294,"children":1295},{"class":389,"line":422},[1296,1301,1306],{"type":31,"tag":387,"props":1297,"children":1298},{"style":470},[1299],{"type":36,"value":1300},"email ",{"type":31,"tag":387,"props":1302,"children":1303},{"style":697},[1304],{"type":36,"value":1305},"=",{"type":31,"tag":387,"props":1307,"children":1308},{"style":400},[1309],{"type":36,"value":1310}," \"user@example.com\"\n",{"type":31,"tag":387,"props":1312,"children":1313},{"class":389,"line":435},[1314,1319,1323],{"type":31,"tag":387,"props":1315,"children":1316},{"style":470},[1317],{"type":36,"value":1318},"hashed ",{"type":31,"tag":387,"props":1320,"children":1321},{"style":697},[1322],{"type":36,"value":1305},{"type":31,"tag":387,"props":1324,"children":1325},{"style":470},[1326],{"type":36,"value":1327}," hashlib.sha256(email.strip().lower().encode()).hexdigest()\n",{"type":31,"tag":387,"props":1329,"children":1330},{"class":389,"line":448},[1331],{"type":31,"tag":387,"props":1332,"children":1333},{"style":688},[1334],{"type":36,"value":1335},"# Returns 64-character hash like 7d8a3c2e1f...\n",{"type":31,"tag":32,"props":1337,"children":1338},{},[1339],{"type":36,"value":1340},"Security layer: sGTM container IP is whitelisted at Meta. Only events from approved IPs are accepted. Access token rotation window is 90 days. If leaked, revoke instantly from Events Manager—new token generates in 30 seconds.",{"type":31,"tag":32,"props":1342,"children":1343},{},[1344],{"type":36,"value":1345},"Pixel fallback scenario: if sGTM is down (Cloud Run region fails, DNS issue), client-side pixel sends event directly to Meta. This dual-send strategy guarantees 99.95% uptime. But deduplication doesn't work in this case—both events count separately. Monitoring: sGTM container logs stream to Stackdriver; critical errors trigger Slack webhook.",{"type":31,"tag":32,"props":1347,"children":1348},{},[1349],{"type":36,"value":1350},"Meta CAPI + sGTM architecture is the backbone of performance marketing in 2026. As iOS privacy updates continue, browser-based tracking narrows further. Companies now treat this transition not as \"trend\" but as \"platform requirement.\" Campaigns with EMQ score below 7 get stuck in learning phase; CPA runs 40%+ high. Building this architecture right demands engineering discipline—copy-paste tutorials don't cut it. When server-side infrastructure joins first-party data strategy, attribution reliability climbs to 95%. Now it's time to push test events into live traffic and watch EMQ score climb.",{"type":31,"tag":1352,"props":1353,"children":1354},"style",{},[1355],{"type":36,"value":1356},"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);}",{"title":15,"searchDepth":435,"depth":435,"links":1358},[1359,1360,1363,1366,1367],{"id":41,"depth":422,"text":44},{"id":62,"depth":422,"text":65,"children":1361},[1362],{"id":139,"depth":435,"text":142},{"id":367,"depth":422,"text":370,"children":1364},[1365],{"id":644,"depth":435,"text":647},{"id":1225,"depth":422,"text":1228},{"id":1255,"depth":422,"text":1258},"markdown","content:fr:marketing:meta-capi-server-side-conversion-tracking.md","content","fr\u002Fmarketing\u002Fmeta-capi-server-side-conversion-tracking.md","fr\u002Fmarketing\u002Fmeta-capi-server-side-conversion-tracking","md",1781647448372]