Stape Margin Lookup Variable for Google Tag Manager Server Container

The Stape Margin Lookup Variable for GTM Server allows you to retrieve margin data from Stape POAS Data Feed or Stape Data Store for each product in your items array and returns a combined margin value that accounts for quantity, enabling you to track Profit on Ad Spend (POAS) for your conversion events and advertising campaigns.

Useful Resources

How to Configure Stape Data Store as a Product Feed Source

When using Stape Data Store to store margin data, you must organize it following the schema below. In Stape Data Store, margin data is organized in collections, where each document in a collection represents a single product:

  • Document ID — must match the product ID used in your items array (e.g., the value of item_id).
  • Margin value field — a numeric field holding the margin amount. Defaults to margin; configurable via the Feed key for profit margin value setting in the template.
  • Margin type field (optional) — a string field set to either absolute (fixed currency amount) or percent (fraction of revenue). Defaults to value_type; configurable via the Feed key for profit margin value type setting.

Product data can be uploaded to Stape Data Store via the REST API, and through the Stape Data Store interface via CSV import or manually.

Open Source

The Stape Margin Lookup Variable for GTM Server Side is developed and maintained by the Stape Team under the Apache 2.0 license.

GTM Gallery Status

:green_circle: Listed

GitHub

:green_circle: Repository

stape-io/stape-store-margin-lookup-variable — updated: view commit

  • Renamed “Stape Product Feed” to “Product Feed” in profit margin variable description
  • Added option to use item price as fallback if item margin is missing in Product Feed
  • Introduced discount calculation in profit margin with item-level and order-level discount types
  • Added discount formula options for item-level discounts: discount over item price or item profit
  • Adjusted profit margin calculation logic to incorporate selected discount settings and formulas

GTM Gallery Status

:green_circle: Listed

stape-io/stape-store-margin-lookup-variable — updated: view commit

  • Removed all logging functionality including console and BigQuery logging options and related configuration settings

GTM Gallery Status

:green_circle: Listed

stape-io/stape-store-margin-lookup-variable — updated: view commit

  • Changed keyPatterns list item from “items” to removed entirely
  • Updated key match string from “specific” to “any”

GTM Gallery Status

:green_circle: Listed

stape-io/stape-store-margin-lookup-variable — updated: view commit

  • Renamed the variable from “Stape Store Margin Lookup” to “Stape Margin Lookup”
  • Rebranded “Stape Store” to “Stape Data Store” in the source dropdown, help text, and collection and container API key field descriptions
  • Updated the variable description to mention both the POAS Data Feed and Stape Data Store as lookup sources

GTM Gallery Status

:green_circle: Listed