Google Tag Manager

How to Track Revenue Using GTM

📈 A Step-by-Step Guide to Implementing Revenue Tracking in Convert via Google Tag Manager—No Developer Needed!

 

THIS ARTICLE WILL HELP YOU:

📊 Track Revenue with GTM

You can utilize Google Tag Manager (GTM) to insert the HTML code to track revenue in Convert. This can be inserted as a GTM tag. With GTM you might not need the help of your webmaster or IT department to track revenue.

However, you would still need to map your e-commerce revenue variables to the Convert variables. You can read more about it in the article: Add Revenue Tracking to Your Site.

If you use an already available e-commerce integration, you might not need to do this, as this is already done for you on many of those integrations. Check your integration to see if it includes revenue tracking.

⚙️ Configure the GTM Tag

To configure the GTM Tag follow these steps:

  1. Access GTM and initiate a new tag setup by clicking on the tag icon.

  2. Select the tag type as Custom > Custom HTML.

  3. Insert both the Convert standard tracking code AND the revenue tracking code (in that order) to ensure proper transaction registration.

  4. Select the Trigger type as "Page View".

  5. Select "Some Page Views" on "This trigger fires on".

  6. Select "Page URL".

  7. Enter criteria to match your confirmation purchase URL.

  8. Rename the Trigger name as "Purchase Confirmation Page" and save it.

  9. Select "Advanced Settings", set the priority to "2", and save the tag.

✅  Ensuring That Purchases Are Registering Correctly

When implementing revenue tracking via GTM, it's recommended to include both the Convert standard tracking code and the revenue tracking code in the same Custom HTML tag. This ensures proper transaction registration, especially when revenue conversions are not pulling uniformly.

Here’s the complete code that should be added to your GTM Custom HTML tag:


<!-- begin Convert Experiences code -->
<script type="text/javascript" src="//cdn-4.convertexperiments.com/v1/js/10014852-10014302.js?environment=production">
</script>
<!-- end Convert Experiences code -->

<!-- Convert Experiments revenue tracking --> 
<script type="text/javascript"> 
window._conv_q = window._conv_q || [];
_conv_q.push(["pushRevenue", {{transactionTotal}}, {{productCount}}, "100137182"]); 
</script>

 

⚠️ Important Note:

  • Always place the Convert standard tracking code BEFORE the revenue tracking code

  • Replace the standard tracking code with your unique Convert project code

  • Replace { {transactionTotal} } and { {productCount} } with your GTM variables

  • Use your specific goal ID (in this example it's "100137182")

 

🔄 Using GTM Variables in Convert Revenue Tracking

You can replace the static values in the Convert revenue tracking code with GTM variables. Here's an example:

Original Code:

<!-- Convert Experiments conversion tracking --> 
<script type="text/javascript"> 
window._conv_q = window._conv_q || []; 
_conv_q.push(["pushRevenue", "revenue", "products_cnt", "100137182"]); 
</script>

With GTM Variables:


<!-- Convert Experiments conversion tracking --> 
<script type="text/javascript"> 
window._conv_q = window._conv_q || []; 
_conv_q.push(["pushRevenue", {{transactionTotal}}, {{productCount}}, "100137182"]); 
</script>

Where:

  • { {transactionTotal} } is your GTM variable containing the order total

  • { {productCount} } is your GTM variable containing the number of products

  • "100137182" is your Convert goal ID (keep this as is)

⚠️  Important:

  • Make sure these variables already exist in GTM and are pulling the correct values from your data layer

  • Place the Convert standard tracking code before the revenue tracking code in your GTM HTML tag

  • The goal ID should remain static and match the ID in your Convert account