Stape
Search
Try for free

Profit on Ad Spend: why it matters and how to set it up via Stape Store

Updated
Oct 17, 2024
Published
Oct 10, 2024

By default, marketing platforms such as Google Ads or Google Analytics report the revenue from purchases instead of profit, which often includes taxes, shipping, and other fees. Consequently, the data you get isn't reliable as it does not take into account your actual earnings on a particular purchase.

To effectively estimate the results of advertising campaigns and your marketing efforts, you need to track the Profit on Ad Spend (ROAS). This marketing metric will be helpful for current performance analysis and planning future advertising campaigns. In this article, we will explain the importance of the Profit on Ad Spend metric and how to start tracking it easily. 

Why do you need to track Profit on Ad Spend?

Profit on Ad Spend (ROAS) helps more precisely evaluate the performance of advertising campaigns. Unlike other popular formulas, such as Return on Ad Spend, it takes into account the actual profit after subtracting any additional costs (e.g., taxes, shipping costs).

Relying on profit instead of revenue generated leads to more effective ad campaign analysis and better business decisions.

To achieve this, you don't need to send the full number of conversions; you only need to send your earnings, depending on what products were purchased.

So the main task is to store your earnings data for each product somewhere and send this data instead of the purchase amount.

Methods to configure Profit on Ad Spend

Add to dataLayer

A dataLayer is a JavaScript object that holds and passes information about the page or user's interactions to tags. It can also be used to set up Profit on Ad Spend tracking. However, it has a significant drawback - low data security. Technically, the data you store in a dataLayer can be easily accessed through the browser's developer tools, like the "Inspect" function.

The dataLayer is a good solution for collecting lightweight data (e.g., cart data); if that’s the case for you, check our end-to-end guide on dataLayer in Google Tag Manager.

Create a lookup table or custom JavaScript variable

Such a method works via GTM setup. You need to create a lookup table variable or custom JavaScript that will collect data. However, this method will work only if you don't have a significant amount of items. Lookup tables or custom JavaScript variables will be inconvenient for dozens or hundreds of products.

Use external database

Storing product IDs and profit from them in an external database is the most effective approach to tracking Profit on Ad Spend. It is a highly secure method that allows you to store an enormous amount of data about the items you sell.

However, it has several difficulties with configuration, especially with connecting to the external database. To simplify the setup process, you can choose Stape Store, a cloud database created for Stape users.

Read our article on top cloud databases for server GTM to choose the best one for your business.

Benefits of Stape Store as a cloud database

Stape Store has numerous advantages as a cloud database for server GTM:

  • Specifically created for data storage from GTM. This allows you to avoid errors that you may face due to the complicated configuration of the database for server GTM.
  • No additional setup is required. Stape Store is seamlessly integrated with Stape hosting.
  • No additional costs for users with the Pro or higher plan. There are no limitations on the data you can store.
Stape Store

How to set up Profit on Ad Spend via Stape Store

As an example, we will consider using a cloud database (Stape Store) for Shopify CMS to set up the tracking of Profit on Ad Spend.

Step 1: Upload product data to Stape Store

1.1 Export product data from the Content management system (CMS) in CSV format.

To do it in Shopify, you should go to the "Products" menu section → Export → Export all the products in CSV.

Please note that Shopify has built-in functionality in its product data to determine profit and margin. If you are using this Shopify functionality - it will simplify further customization.

Shopify feature to determine profit and margin

1.2 Edit CSV file.

A typical CSV file often includes numerous irrelevant fields that are unnecessary when calculating Profit on Ad Spend. Usually, you need to remove these columns: product categories, type, names, weight, quantity, etc. In our example, we keep only the following columns:

  • Title - name of the items;
  • Variant SKU - this data will be used to search for margin; This should be the product id that is available in your data layer or event on the server.
  • Variant price - original price of the product;
  • Cost per item - your cost of production. It will be filled in if you are managing this in Shopify.

Besides this data, you also need to calculate profit. Unfortunately, Shopify doesn't export profit by product, so you need to add it manually. To do it, just add a new column, then you should add a formula to this column that calculates the variant price minus cost per item, and apply this to all products.

Formula to calculate profit

Note: If you don't have data on the Cost Per Item or don't use Shopify, you need to specify your earnings instead of the full price for each item. And then just use that column as a product margin in the future.

1.3 Import edited CSV file to Stape Store.

To do it, go to Stape account → Choose the container → Store tab → Upload CSV.

Upload CSV file to Stape Store

After uploading the CSV file, ensure that all products contain the necessary data - specifically, the product ID or SKU and the field where the product’s profit value is stored. In our example, these fields are the variant SKU and Cost Per Item parameters (please note that Cost Per Item is only available if specified in your Shopify settings).

Step 2: Configure web and server GTM

2.1 Configure web GTM container.

In this step, you need to set up the sending GA4 purchase event with a standard basic payload (items, value, and currency); see the example below as a reference:

Web tag configuration

If you have any difficulties with tags configuration for GA4 and/or Shopify, see our related blog posts:

2.2 Configure server GTM container.

On the server GTM container, you need to use Stape Store Margin Lookup, which will look for the margin in Stape Store for each product based on the items parameter that comes to the server.

You can either add Stape Store Margin Lookup in Template Gallery or download the Margin Lookup Variable on GitHub and manually add it as a user-defined variable in the GTM server.

Once you have Stape Store Margin Lookup in your server GTM container, create a new variable with the following settings:

  • The field containing product ID in your Stape Store - in our example, we are using the SKU as the product ID; in Stape Store, this is uploaded as the "VariantSKU" field.
  • The field containing margin value in your Stape Store - we added "MarginValue" here as with this name, which was uploaded to the Stape Store.
  • Select option to be used as product ID from items array - the variable takes the items array from the incoming event and checks one of three standard parameters in it: item_id / item_sku / item_variant - choose the right one for you, depending on where it contains the same format as uploaded to the Stape Store. In our example, it’s item_sku.
Variable configuration

Add this variable as a value to the tags you want. We use this in the example to report the value in Google Ads Conversion:

Variable as a value to the tags

Test the setup

To test if everything works correctly, run Preview and Debug Mode in your GTM containers and make the conversion you want.

We will test the setup on a purchase event. We purchased two items with SKU ‘NOP-3456’ their actual price is 17.99 * 2 = 35.98 USD.

Test the setup in GTM

However, item_sku in Stape Store found an item with MarginValue 3.99 * 2 = 7.98 USD.

Test in Stape Store

And the conversion for this amount was sent to Google Ads:

Purchase event sent to Google Ads

Please note:If the Stape Store Margin Lookup variable doesn't find a match in the database or the parameter is missing from the item's array, the original price from the array will be used for that specific item.

Everything will still function if you add a new item to the shop but haven't yet updated the CSV in the Stape Store. However, the actual price will be used instead of the margin value for unrecognized items.

Conclusion

Profit on Ad Spend is a helpful metric for your business to track. Unlike other metrics such as ROAS, it measures the gross profit generated for every dollar spent on an ad, so it shows the profit after subtracting any possible additional costs like taxes and shipping costs. This gives you a clear view of ad campaign profitability, enabling you to make more informed decisions.

The most effective way to track Profit on Ad Spending is to use an external database. You may consider Stape Store to be a cloud database for this purpose. It is seamlessly integrated with Stape, so it doesn't require any additional setup; in addition, the Stape Store is available for users with the Pro or higher plan.

The only challenge with tracking configuration is to keep the CSV file updated with product data. Still, we are actively working on optimizing this process to eliminate the need for manual updates.

Try Stape for all things server-sideright now!