Share on facebook
Share on twitter
Share on linkedin
Share on email

Google Tag Manager Debugging Quick Tips

gtm bug

Google Tag Manager’s preview mode allows you to browse a site on which your container code is implemented as if the current container draft was deployed.

In addition to using GTM Preview mode for debugging your GTM configuration here are two other quick tips to help you validate your configuration or assist you in testing your site more effectively.

Use Javascript to check if you are in Preview Mode

To make sure that you aren’t accidentally putting unnecessary console logs in your production environments you can add this conditional logic around your code.


var isGTMPreviewMode = {{Container Version}} == "QUICK_PREVIEW";
if(isGTMPreviewMode)console.log("Yay I'm only visible in preview mode!");

 

Log dataLayer pushes to the console

This is useful for being able to check what values are in the dataLayer on a site without having to dig through the dataLayer object each time to find the event you want to view.


var oldDLpush = dataLayer.push;
dataLayer.push = function(){
	oldDLpush();
	console.log(arguments[0]);
}

Check out our other Quick Tip about Google Tag Manager

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on email
Email

Other Articles You Will Enjoy

InfoTrust Becomes Official Google Cloud Partner

InfoTrust Becomes Official Google Cloud Partner

For years, the experienced cloud engineering team at InfoTrust has helped major multi-brand clients across the globe drive their business objectives forward. With a…

Deloitte Recognizes InfoTrust in Annual Technology Fast 500 Ranking

Deloitte Recognizes InfoTrust in Annual Technology Fast 500 Ranking

Last week, Deloitte honored the experienced digital analytics consulting, data governance, and technology team at InfoTrust among the 500 fast-growing North American companies in…

The Most Useful Google Analytics Reports and Dashboards for Black Friday

The Most Useful Google Analytics Reports and Dashboards for Black Friday

With the holiday season rapidly approaching, Black Friday weekend is just around the corner. Recently, we asked if your digital analytics team is ready…

Migrating Tag Inspector from Python 2 to Python 3

Migrating Tag Inspector from Python 2 to Python 3

Recently, our engineering team completed a migration of our proprietary tag auditing and management platform from Python 2 to Python 3. This upgrade brings…

Get to Know All the Products in the Google Marketing Platform

Get to Know All the Products in the Google Marketing Platform

While most organizations are aware of the Google marketing stack, many only utilize one or two of its products. While using a single Google…

In-Housing in Your Organization’s Future? Start with This Conversation

In-Housing in Your Organization’s Future? Start with This Conversation

It’s time to have a real conversation about your company’s internal structure and capabilities. Are you being asked by management to make in-housing a…

Tag Inspector’s Cookie Detection Feature Receives Quanties Award for Best New Technology

Tag Inspector’s Cookie Detection Feature Receives Quanties Award for Best New Technology

At the Digital Analytics Association’s OneConference event last evening in Chicago, Tag Inspector’s new cookie detection feature received the Quanties Award for Best New…

Lead Analytics Consultant Mai AlOwaish Honored with DAA President’s Award

Lead Analytics Consultant Mai AlOwaish Honored with DAA President’s Award

At InfoTrust, our team works not only to grow our business and community, but also to further the digital analytics industry as a whole….

Join InfoTrust on the Journey Towards Organizational Maturity in Supporting Equality in Tech

Join InfoTrust on the Journey Towards Organizational Maturity in Supporting Equality in Tech

One of the pivotal moments of my career as an entrepreneur was hearing Jeff Hoffman share his legacy as a founder of Priceline.com, uBid.com,…

Our website uses cookies and may collect user information to provide a good experience. Read our Privacy Policy here.

Leave Us A Review

Leave a review and let us know how we’re doing. Only actual clients, please.