{"id":1859,"date":"2025-09-08T20:15:05","date_gmt":"2025-09-08T18:15:05","guid":{"rendered":"https:\/\/webmasterei-prange.de\/better-data-better-decisions-data-enrichment-in-server-side-tracking\/"},"modified":"2025-12-02T18:13:48","modified_gmt":"2025-12-02T17:13:48","slug":"better-data-better-decisions-data-enrichment-in-server-side-tracking","status":"publish","type":"post","link":"https:\/\/webmasterei-prange.de\/en\/better-data-better-decisions-data-enrichment-in-server-side-tracking\/","title":{"rendered":"Better data, better decisions: Data enrichment in Server-Side Tracking"},"content":{"rendered":"<style>.kb-image1183_8cf785-00 .kb-image-has-overlay:after{opacity:0.3;}<\/style>\n<figure class=\"wp-block-kadence-image kb-image1183_8cf785-00 size-full\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/webmasterei-prange.de\/wp-content\/uploads\/2025\/09\/beitragsbild.png.webp\" alt=\"Featured image.png\" width=\"1532\" height=\"853\" class=\"kb-img wp-image-1858 \"><\/figure>\n\n<p>Success in digital marketing depends significantly on the quality of the available data. <a href=\"https:\/\/webmasterei-prange.de\/en\/server-side-tracking-with-gtm-agency-for-precise-gdpr-compliant-marketing\/\" title=\"Server-side tracking\">Server-side tracking<\/a> and the associated data enrichment offer the opportunity to gain deeper insights, make more precise decisions, and ultimately use advertising budgets more efficiently.<\/p>\n\n<p class=\"has--font-size\"><strong>Optimization based on POAS instead of ROAS<\/strong><\/p>\n\n<p>A decisive advantage for companies is the <strong>optimization of POAS<\/strong> (Profit on Advertising Spend), which allows for a more precise evaluation of the profitability of marketing measures than the conventional ROAS (Return on Advertising Spend) model. This can be a decisive competitive advantage, especially when there are strong margin fluctuations in the product range. <\/p>\n\n<p class=\"has--font-size\"><strong>Event Value Attribution<\/strong><\/p>\n\n<p>Business models with longer decision-making processes can particularly benefit from <strong>Event Value Attribution<\/strong> between various e-commerce signals such as (add_to_cart  purchase). This provides a more accurate capture of the customer journey and helps maximize early purchase signals. <\/p>\n\n<p><strong>Business data<\/strong><\/p>\n\n<p>Furthermore, the integration of external business data, such as <strong>customer groups<\/strong> or <strong>scoring values<\/strong> from other systems, allows for improving the data situation and, for example, moving customers into specific target groups in real-time.<\/p>\n\n<h2 class=\"wp-block-heading\">Technical Overview<\/h2>\n\n<h3 class=\"wp-block-heading\">What is a Server-Side Tag Manager?<\/h3>\n\n<p>A Server-Side Tag Manager (SSTM) is a solution for managing and controlling tags that are executed on a server instead of on the client (browser). Unlike traditional client-side tag managers, SSTM offers numerous advantages, including improved performance, increased security, and better data control. <\/p>\n\n<h3 class=\"wp-block-heading\">Advantages of Server-Side Tag Management<\/h3>\n\n<ul class=\"wp-block-list\">\n<li><strong>Improved performance<\/strong>: As tags are processed on the server, the loading time of the website is reduced.<\/li>\n\n\n\n<li><strong>Security<\/strong>: Sensitive data is handled more securely as it is not processed directly in the browser.<\/li>\n\n\n\n<li><strong>Data control<\/strong>: Better control over collected data and its forwarding to various tools and platforms.<\/li>\n\n\n\n<li><strong>Data enrichment<\/strong>: from other sources<\/li>\n<\/ul>\n\n<p>Server-side tag managers are therefore advantageous for a variety of reasons. This article, however, will focus on the topic of data enrichment.  <a href=\"https:\/\/webmasterei-prange.de\/en\/server-side-tracking-with-gtm-agency-for-precise-gdpr-compliant-marketing\/\" title=\"If you want to learn more about server-side tracking, read on here.\">If you want to learn more about server-side tracking, read on here.<\/a><\/p>\n\n<h2 class=\"wp-block-heading\">Data enrichment in the Server Side Tag Manager<\/h2>\n\n<p>To enrich data in the Server Side Tag Manager, we need a data basis that is available in real-time. Firestore in Google Cloud provides this. The data is transferred from a data source like BigQuery to Firestore and later retrieved through a Firestore variable in the Server Side Tag Manager.  <\/p>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/webmasterei-prange.de\/wp-content\/uploads\/2025\/09\/Serveride-Tracking-mit-Datenanreichung-1024x576.png\" alt=\"Server-side tracking with data enrichment\" class=\"wp-image-1908\"\/><figcaption class=\"wp-element-caption\">Server-side tag manager with data enrichment from BigQuery via Firestore<\/figcaption><\/figure>\n\n<h2 class=\"wp-block-heading\">Use Case I: POAS instead of ROAS<\/h2>\n\n<p>While ROAS (Revenue on Ad Spend) is a common metric in online marketing that measures revenue in relation to advertising expenses, POAS (Profit on Ad Spend) takes a crucial step further. POAS focuses on actual profit and considers not only revenue but also the direct costs and margins of a product or service. This results in normalizing income in relation to expenses.  <\/p>\n\n<p><strong>Target audience:<\/strong> <a href=\"https:\/\/webmasterei-prange.de\/en\/tracking\/\" title=\"Google Ads Ecommerce\">Google Ads ecommerce<\/a> customers with significantly different margins in their product range.<\/p>\n\n<p>Example:<\/p>\n\n<ul class=\"wp-block-list\">\n<li><strong>ROAS<\/strong>: If a company spends 100 euros on advertising and generates 500 euros in revenue, the ROAS is 5 (500 \/ 100).<\/li>\n\n\n\n<li><strong>POAS<\/strong>: Here, the profit from the 500 euros revenue is considered after deducting costs (e.g., production, storage, or shipping costs). If the profit after costs is 200 euros, the POAS is 2 (200 \/ 100). <\/li>\n<\/ul>\n\n<p><strong>Calculation of POAS:<\/strong><\/p>\n\n<ul class=\"wp-block-list\">\n<li>Profit = (Sales price \u2013 VAT \u2013 Purchase price of the goods * (1 \u2013 Return rate))<\/li>\n<\/ul>\n\n<p><strong>Data sources:<\/strong><\/p>\n\n<ul class=\"wp-block-list\">\n<li>Selling price: From the customer&#8217;s shopping cart<\/li>\n\n\n\n<li>VAT: From the customer&#8217;s shopping cart<\/li>\n\n\n\n<li>Purchase price: From the shop system<\/li>\n\n\n\n<li>Return rate: Calculated from the shop system<\/li>\n<\/ul>\n\n<h3 class=\"wp-block-heading\">Data sources for POAS calculation<\/h3>\n\n<p>In this specific case, the customer transfers the purchase prices of the products into their shop system. Since we have an internal data transfer from the shop system to BigQuery, it was easy to use the product data field from Shopware to perform the calculation. <\/p>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"472\" src=\"https:\/\/webmasterei-prange.de\/wp-content\/uploads\/2025\/09\/daten-in-firestore-laden-2-1024x472.png\" alt=\"Loading data into firestore 2\" class=\"wp-image-1190\"\/><\/figure>\n\n<h3 class=\"wp-block-heading\">Calculation in the Server-side Tag Manager<\/h3>\n\n<p>Now that the profit data is available in Firestore, it needs to be retrieved using a variable. There are already ready-made solutions for this, such as <a href=\"https:\/\/github.com\/google-marketing-solutions\/gps_soteria\" target=\"_blank\" rel=\"noreferrer noopener\">Sorteria<\/a> from the <a href=\"https:\/\/github.com\/google-marketing-solutions\/gps-sgtm-pantheon\" target=\"_blank\" rel=\"noreferrer noopener\">sgtm-pantheon<\/a> . <\/p>\n\n<p>According to the Git repo, the naming is derived as follows:<\/p>\n\n<blockquote class=\"wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Sorteria \u2013 Goddess of safety, and deliverance and preservation from harm. Like the goddess, this project provides security from end users to your sensitive value data (eg profit). <\/p>\n<\/blockquote>\n\n<p>Among other things, Sorteria addresses the problem that profit values must be calculated per shopping cart item and then output as a total amount. Details can be found <a href=\"https:\/\/github.com\/google-marketing-solutions\/gps_soteria\/blob\/main\/docs\/README.md\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>. <\/p>\n\n<p>Example:<\/p>\n\n<ul class=\"wp-block-list\">\n<li><strong>Article 1:<\/strong> Revenue 100\u20ac, Profit 50\u20ac, Quantity 1<\/li>\n\n\n\n<li><strong>Article 2:<\/strong> Revenue 20\u20ac, Profit 13\u20ac, Quantity 2<\/li>\n\n\n\n<li><strong>Total:<\/strong> Revenue 140\u20ac, Profit 76\u20ac<\/li>\n<\/ul>\n\n<p>Once the value is fully calculated, it can be passed on to any conversion tag so that the modified value is then recorded. For analysis purposes, however, it is always recommended to track the normal revenue value in a parallel event, so that direct comparisons are always possible. <\/p>\n\n<h3 class=\"wp-block-heading\">Result<\/h3>\n\n<p>For the customer, this creates the convenient situation that their POAS data, unlike sales, is normalized. This means that the result always represents the same amount of business value and this result doesn&#8217;t fluctuate between different products. This also makes life easier for the SEA manager because the customer&#8217;s specifications can be formulated more clearly in the future.  <\/p>\n\n<h2 class=\"wp-block-heading\">Use Case II: Event Value Attribution<\/h2>\n\n<p><strong>Event Value Attribution<\/strong> is a process in which a value is assigned to certain events before a purchase. The goal is to distribute the sales value fairly across important pre-purchase events. <\/p>\n\n<p><strong>The aim of the procedure<\/strong> is to reward the bidding system appropriately for early events towards purchase, with approximately similar ROAS.<\/p>\n\n<p><strong>Target group:<\/strong> Google Ads customers with particularly long or complex purchase processes<\/p>\n\n<p><strong>Example calculation<\/strong> :<\/p>\n\n<p>An online shop sells a product for \u20ac100. Over a 90-day period, Google Analytics measured 10 purchase and 100 add_to_cart events for the product. In the conversion measurement, the sales value should now be divided between add_to_cart and purchase events, so that the sales value is approximately \u20ac100.  <\/p>\n\n<p>10 (purchase) \/ 100 (add_to_cart) = 0.1 add_to_cart_rate<\/p>\n\n<p>(add_to_cart_rate * value) \/ 2 (number of event names) = <strong>5 \u20ac add_to_cart_value<\/strong><\/p>\n\n<p>value \/ 2 (number of event names) = <strong>50 purchase_value<\/strong><\/p>\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2223\" height=\"1002\" src=\"https:\/\/webmasterei-prange.de\/wp-content\/uploads\/2025\/09\/ga4-date-in-firestore-1-1.png\" alt=\"Ga4 date in firestore 1\" class=\"wp-image-1189\"\/><\/figure>\n\n<p>The figure shows how GA4 data from BigQuery can be used to make it available to Firestore. Data transfer to Firestore generally works with this <a href=\"https:\/\/github.com\/Webmasterei\/cf_event_value_attribution\" target=\"_blank\" rel=\"noreferrer noopener\">Cloud Function<\/a> . <\/p>\n\n<h3 class=\"wp-block-heading\">Data preparation in BigQuery<\/h3>\n\n<p>To determine the add_to_cart_rate, it should be calculated for several levels. This is easiest in BigQuery with a SUM() OVER() window function. This way, we get not only the add_to_cart_ratio at the product level for each row, but also for the levels item_group_id, product_type, brand, and total.  <\/p>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT\n  *,\n  -- item_group_id scope,\n  SUM(add_to_cart) OVER(PARTITION BY item_group_id) AS add_to_cart_item_group_id,\n  SUM(purchase) OVER(PARTITION BY item_group_id) AS purchase_item_group_id,\n  -- product_type scope,\n  SUM(add_to_cart) OVER(PARTITION BY product_type) AS add_to_cart_product_type,\n  SUM(purchase) OVER(PARTITION BY product_type) AS purchase_product_type,\n  -- brand scope,\n  SUM(add_to_cart) OVER(PARTITION BY brand) AS add_to_cart_brand,\n  SUM(purchase) OVER(PARTITION BY brand) AS purchase_brand,\n  -- total scope,\n  SUM(add_to_cart) OVER() AS add_to_cart_total,\n  SUM(purchase) OVER() AS purchase_total\nFROM all_items\nGROUP BY ALL;\n<\/pre>\n\n<p>In order to get the most relevant number possible as the final add_to_cart_ratio, we search for it using a CASE WHEN statement.<\/p>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT\n  *,\n  -- purchase_add_to_cart_selected\n  CASE\n  -- product scope\n  WHEN add_to_cart  10 AND purchase  10  \n  THEN purchase_add_to_cart_product\n\n  -- item_group_id scope\n  WHEN item_group_id IS NOT NULL  \n  AND item_group_id != ''  \n  AND add_to_cart_item_group_id  10  \n  AND purchase_item_group_id  10  \n  THEN purchase_add_to_cart_item_group_id\n\n  -- product_type scope\n  WHEN product_type IS NOT NULL  \n  AND product_type != ''  \n  AND add_to_cart_product_type  10  \n  AND purchase_product_type  10  \n  THEN purchase_add_to_cart_product_type\n\n  -- brand scope\n  WHEN brand IS NOT NULL  \n  AND brand != ''  \n  AND add_to_cart_brand  10  \n  AND purchase_brand  10  \n  THEN purchase_add_to_cart_brand\n\n  ELSE purchase_add_to_cart_total\n  END AS purchase_add_to_cart_selected\nFROM calculations;\n<\/pre>\n\n<p>The CASE statement ensures that a level is only used if more than 10 add_to_cart actions are present. If the action isn&#8217;t sufficiently available for the product, item_group_id, product_type, and brand levels, the total is used, which then represents the shop level. <\/p>\n\n<h3 class=\"wp-block-heading\">Result<\/h3>\n\n<p>The method is useful for customers when there is a longer customer journey before the purchase or when a device change without login is likely.<\/p>\n\n<p>This gives e-commerce companies the opportunity to incorporate early purchase signals into the bidding system as relevant rewards, without having to live with the fear of creating large-scale false incentives, as the value distribution takes place dynamically based on the old transaction data.<\/p>\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n<p>Data enrichment in the Server-Side Tag Manager offers significant advantages for digital marketing companies. By focusing on POAS instead of ROAS, companies can more accurately measure the true profitability of their marketing efforts, which is particularly crucial for product ranges with widely varying margins. Event Value Attribution allows the value of pre-purchase events such as add_to_cart to be appropriately considered, allowing longer and more complex customer journeys to be better mapped.  <\/p>\n\n<p>Technically speaking, the use of a Server-Side Tag Manager offers improved performance, increased security, and better control over collected data. The integration of real-time data sources such as Firestore and BigQuery allows complex calculations to be performed directly in the Tag Manager and efficiently incorporates external business data. Tools like Sorteria facilitate the calculation and aggregation of profit values at the product level.  <\/p>\n\n<p>For SEA managers and marketing teams, this means a more precise data foundation on which to base informed decisions. Advertising budgets can be used more efficiently, as campaign performance evaluation is based on actual profits rather than just revenues. The dynamic value distribution minimizes the risk of misaligned incentives and maximizes the benefit from early purchase signals.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Success in digital marketing depends significantly on the quality of the available data. Server-side tracking and the associated data enrichment offer the opportunity to gain deeper insights, make more precise decisions, and ultimately use advertising budgets more efficiently. Optimization based on POAS instead of ROAS A decisive advantage for companies&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1858,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","slim_seo":{"title":"Data enrichment & server-side tracking for better marketing decisions","description":"How server-side tracking with data from BigQuery & Firestore helps you optimize POAS instead of ROAS, value pre-purchase signals, and use marketing budgets more efficiently."},"footnotes":""},"categories":[25],"tags":[],"class_list":["post-1859","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-tracking"],"taxonomy_info":{"category":[{"value":25,"label":"Website tracking"}]},"featured_image_src_large":["https:\/\/webmasterei-prange.de\/wp-content\/uploads\/2025\/09\/beitragsbild.png-1024x570.webp",1024,570,true],"author_info":{"display_name":"admin","author_link":"https:\/\/webmasterei-prange.de\/en\/author\/admin\/"},"comment_info":0,"category_info":[{"term_id":25,"name":"Website tracking","slug":"website-tracking","term_group":0,"term_taxonomy_id":25,"taxonomy":"category","description":"","parent":0,"count":11,"filter":"raw","cat_ID":25,"category_count":11,"category_description":"","cat_name":"Website tracking","category_nicename":"website-tracking","category_parent":0}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/posts\/1859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/comments?post=1859"}],"version-history":[{"count":4,"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/posts\/1859\/revisions"}],"predecessor-version":[{"id":2233,"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/posts\/1859\/revisions\/2233"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/media\/1858"}],"wp:attachment":[{"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/media?parent=1859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/categories?post=1859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webmasterei-prange.de\/en\/wp-json\/wp\/v2\/tags?post=1859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}