Duplicate Transaction Blocker Recipe

September 2, 2020 | Bounteous x Accolite

Duplicate transactions in Google Analytics are among the most common data integrity problems we encounter for commerce sites. Duplicate transactions inflate revenue, skew attribution reports, and create discrepancies with sales records in enterprise resource platforms. In every property type, they compromise the integrity of your data, threaten the effectiveness of your decisions, and undermine your efforts to foster a data culture. 

The Bounteous Duplicate Transaction Blocker recipe contains everything you need to block repeat transactions in your existing web property. With a few tweaks, you can make it work in your Google Tag Manager container.

Ingredients

Tags

None

Triggers

Blocking - Transaction Already Fired

Variables

Const - GA Transaction IDs Cookie Name

Const - Transaction ID Separator

DLV - transactionId

JS - checkIfTransactionStored Function

JS - Ecommerce Hit hitCallback

JS - GA Transaction IDs Cookie Getter

JS - Stored Transaction IDs

JS - Transaction Was Never Fired Before

Instructions

1. Download Container File

Download the container JSON file for the Bounteous Duplicate Transaction Blocker Recipe for Google Tag Manager.

2. Import JSON File into Google Tag Manager

Log into your own Google Tag Manager container and head to the Admin section of the site. Under Container options, select Import Container. Check out this blog post for more details about importing a container file.

3. Ensure the Transaction ID is Being Referenced Properly.  

Either 1) update the {{DLV - TransactionId}} variable to point at the correct data layer variable, or 2) update {{JS - checkIfTransactionStored Function}} and {{JS - Ecommerce Hit hitCallback}} and replace references to {{DLV - TransactionId}} with the correct variable.

4. Enable Override Settings in the Tag

On your purchase event tag, enable override settings in the tag. Under Fields to Set, add a field name hitCallback with a value {{JS - Ecommerce Hit hitCallback}}.

5. Add the Blocking Trigger

Add the blocking trigger, {{Blocking - Transaction Already Fired}}, to your purchase tag and any other Tags that fire on a new commerce transaction.

6. Preview & Publish

Use the Preview options to test this container on your own site. Try testing each of the events to make sure they’re working properly. If everything looks good, go ahead and publish!