Transaction ID Logger - Custom Tag Template

The Transaction ID Logger custom tag template is a tag template for Google Tag Manager’s community template gallery.

Resource
Gallery entry
GitHub repo

Description

This tag fires after all tags that fire on the same trigger event have completed execution. It stores the Transaction ID provided in the tag into a cookie and/or localStorage entry named __tid_gtm. The value is appended to an array, and this array can be read with the Transaction ID Reader variable template.

The purpose of this setup is to prevent collection of duplicate transactions or purchase conversions.

Instructions

Provide the Transaction ID as a variable into the appropriate field. Typically this is a Data Layer variable from your Enhanced Ecommerce or GA4 dataLayer objects.

Next, you can choose whether to store the ID in a cookie, a localStorage entry, or both. In either case, the name used to store the ID is __tid_gtm. The item is appended to an array, so you might end up with an array that contains multiple Transaction IDs, if you’ve made multiple purchases on the site.

Release notes

Date Changeset
11 December 2020 Initial release.