Skip to main content

Purchase Conversion Pixel with Google Tag Manager

Updated this week

Purpose

This document provides instructions for implementing Flowcode's Purchase Conversion Pixel using Google Tag Manager (GTM). This pixel, or tag as we’ll refer to it here, allows for precise tracking of monetary transactions on external destinations. These are tracked as conversions in the Flowcode platform, which can drive powerful downstream functionality.

Conversion tracking involves implementation of a base tag, as well as a conversion tag which is triggered by a specific conversion event.

Base Tag

The base tag should be installed via a GTM Tag with the type “Custom HTML” and trigger “All Pages”. This tag captures the Flowcode identifier (present in the URL on initial redirect) used to associate the visitor with a potential conversion.

Example base tag:

Purchase Conversion Tag

The purchase conversion tag should be installed via a GTM Tag with the type “Custom HTML”. The purchase conversion tag calls a function unique to the base tag specifically for transmitting conversion data.

Example conversion tag:

NOTE: Data types are important here. Events that fail type checking will not be recorded as conversions within the Flowcode platform. We recommend using an actual transaction/purchase identifier for transaction_id (an order number, for example) associated with the purchase event. Note that transaction_type can be hardcoded to a single value (like “order”), or can be set to a more granular, custom type.

GTM Events and Triggers

The purchase conversion tag fires immediately upon being invoked (unlike the base tag that listens for browser actions), so you will need to ensure that the purchase conversion tag is only attached to triggers that accurately reflect a completed purchase action. This can be an existing google tag manager event, or a custom event that you have defined already in GTM. For more information on setting up events and triggers, see the GTM Documentation here.

Passing In GTM Data Layer and User Defined Variables

In order to pass the correct data to the purchase conversion tag, you may need to create Data Layer Variables in GTM for transactionId, transactionAmount, currency, and any other custom fields you are pushing to the Data Layer.

The Google Tag Manager Data Layer is a JavaScript object (window.dataLayer) that serves as a centralized staging area for data that GTM can access to trigger tags or pass data to marketing and analytics tools.

When you "push" events or data into the dataLayer, GTM can use that information to:

  • Trigger specific tags (e.g., firing a purchase event only when a donation is made).

  • Populate tag parameters (e.g., amount, item name, transaction ID).

Example Data Layer Push for a Purchase:

This code tells GTM that a purchase has occurred and provides the relevant details. The data is then validated within the flowcode system to ensure that the expected fields and values are present.

For more information about how to utilize the Data Layer, see the GTM Documentation here.

Within the purchase conversion tag, you can reference existing or custom GTM user defined variables within the script, denoted with curly braces in this example:

This code tells GTM that a purchase has occurred and provides the relevant details. The keys in the json payload (transactionId, transactionAmount, currency, and transactionType) match the “Data Layer Variable Name” in the User Defined Variable configuration. This data is in turn transmitted to Flowcode, linking the purchase data and conversion to a Flowcode scan or ShortURL click.

For more information about User Defined Variables, see the GTM documentation here.

Analytics

Conversions triggered through the purchase tag will be surfaced in Flowcode Analytics as “Purchases” and will automatically be counted as a conversion for the associated Flow. You will also see these purchases in the Results tab of the Flow.

Within the Analytics dashboard, the "Conversions over time" chart provides a visual overview of tracked purchase events over time. This chart highlights the total number of conversions, allowing you to monitor how your purchase activity trends across different campaigns and timeframes.

In addition to the aggregate chart, the Results tab provides a detailed breakdown of each recorded purchase. For every conversion, you’ll see the following key metrics:

  • Order Number – the unique identifier associated with each transaction

  • Quantity – the number of items included in the purchase

  • Total – the total purchase value transmitted by the conversion pixel

This granular view enables you to validate transaction-level details and measure revenue impact directly within Flowcode Analytics.

Did this answer your question?