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

Which Analytics, TMS, and A/B Testing Platforms are Used by the Top 100 Digital News Outlets?

Which Analytics, TMS, and A/B Testing Platforms are Used by the Top 100 Digital News Outlets?

As the marketing technology landscape continues to grow beyond 8,000 martech solutions (up 13.6% YoY), the team at InfoTrust is taking a deep-dive look…

What is a Data Clean Room?

What is a Data Clean Room?

“Data clean room” is a growing buzzword in marketing, analytics, and advertising industries. Although data clean rooms aren’t an entirely new concept, they haven’t…

Why Executive Teams are Resisting Google Analytics 4 (and What You Can Do to Change Their Minds)

Why Executive Teams are Resisting Google Analytics 4 (and What You Can Do to Change Their Minds)

Few can dispute that the future of analytics will be driven by machine learning and artificial intelligence. With Google’s launch of Google Analytics 4…

InfoTrust to Lead Webinar on Analytics Maturity Using Google Marketing Platform

InfoTrust to Lead Webinar on Analytics Maturity Using Google Marketing Platform

If you’re a marketer looking to sharpen your skills, or a business owner hoping to take your organization to the next level, then look…

InfoTrust Earns Looker Partner Certification

InfoTrust Earns Looker Partner Certification

CINCINNATI — The experienced digital analytics and customer data governance consulting team at InfoTrust is proud to announce that the organization achieved partner status…

Talk To Us

Talk To Us

Receive Book Updates

Fill out this form to receive email announcements about Crawl, Walk, Run: Advancing Analytics Maturity with Google Marketing Platform. This includes pre-sale dates, official publishing dates, and more.

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.