Common Mistakes in Tracking codes and Consent Mode implementations and how to fix them

In recent months, we have audited tracking and consent mode implementations on numerous e-commerce websites, ranging from small online stores to large platforms.
Although each project has its own technical particularities, we have noticed a series of mistakes that almost invariably repeat themselves. This article summarizes these issues and provides suggestions for addressing them, aiming to help technical teams, marketing agencies and e-commerce decision-makers avoid data loss, inaccurate reporting and future roadblocks.
1. Incomplete or incorrect Consent Mode implementation
-
1.a. Many websites have a mixed tracking setup: part of the code is implemented in Google Tag Manager, while another part is added directly to the site through various modules or plugins. In most cases, the consent code triggers too late and a significant portion of requests are sent without consent, or with consent denied.
-
1.b. Most websites allow users to navigate to other pages without expressing their consent (neither accept, nor reject). Without additional configurations, this behavior leads to losing the traffic source for users who do not interact with the consent mode banner.
-
1.c. Missing or incomplete implementation on certain essential pages. We have encountered cases where the thank you page did not have consent mode configured for specific payment methods. All user flows leading to the purchase event should be tested, even if some of them are more difficult to simulate.
Recommendation: Consent Mode should be fully managed through GTM, using solutions from official Google partners. This ensures easier debugging, full control and predictable behavior. All user flows leading to key events, such as the purchase event, should be thoroughly tested.
2. Duplicate codes: GA4, Google Ads, cookie banners, etc.
A common scenario: the same library is included both through GTM and directly from the site (via modules, extensions, apps, or developer-set scripts). Another frequent case: similar apps pushing the same events to the dataLayer. The result is the duplication or even tripling of events.
This distorts data in GA4 and Facebook and other platforms, causes major discrepancies with internal order systems and overestimates campaign performance.
Recommendation: All tracking should be moved into GTM. The duplicate module or script must be identified and removed. Avoid chaotic plugin uninstalls without a clear impact assessment.
3. Duplicated or missing events
Very often, tracking implementations focus exclusively on major events: purchase, add_to_cart, view_item and begin_checkout, while neglecting so-called “non-essential” events such as view_item_list, add_to_wishlist, view_promotion, select_item, add_payment_info, add_shipping_info and remove_from_cart.
Although they may seem secondary, these events provide an overview of user behavior on the website and allow for a holistic analysis of the conversion funnel. They are essential for campaign optimization, understanding friction points and properly training algorithms.
Recommendation: The implementation should be redone starting from the GA4 documentation. Events must include relevant parameters and duplicates must be removed.
4. Issues with product IDs
Another critical point is product ID inconsistency, particularly for products with variants (e.g., a dress in size XS, S, M): on view_item, one ID is sent, and on purchase, another (e.g., variant ID vs. parent ID). This causes mismatches between the product feed and the data in GA4, Google Ads, or Facebook.
Recommendation: Always use the parent product ID and send the variant (e.g., color, size) separately via item_variant.
5. Missing user data
The purchase event should include the user_data object with: email, phone, user_id, address, total number of orders and customer lifetime value. These data enable:
- More accurate attribution.
- Campaign optimization.
Recommendation: This information should always be available in the dataLayer on the purchase event. If the user is logged in, the data should be included on all events. Without it, campaigns will underperform because AI algorithms will have less data to learn from.
Conclusion
A well-structured GTM account, with accurate data and a correctly implemented consent mode, is not just a technical detail. It directly impacts campaign efficiency, retargeting capabilities and ultimately, profitability.
If you have recognized yourself in the examples above, you are not alone. What matters is to acknowledge these issues and address them in time, ideally in a test environment, with clear planning and without improvisation.
If you need support for auditing or restructuring, the Tagual team can help.