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 and Tag Inspector Named Quanties Finalists

InfoTrust and Tag Inspector Named Quanties Finalists

The entire analytics consulting and technology team at InfoTrust is thrilled to be recognized as finalists in three categories at the upcoming DAA OneConference‘s…

Why Having a Data Layer is Critical During Black Friday Weekend

Why Having a Data Layer is Critical During Black Friday Weekend

Black Friday and Cyber Monday annually present marketers with ample eCommerce insights, as high traffic and large purchase volumes offer rich customer data for…

What Is Your Customer Data Doing Right Now?

What Is Your Customer Data Doing Right Now?

Do you or key stakeholders in your organization really know how or if your customer data is being collected, stored, and used? A discussion like…

InfoTrust Named to Inc. 5000 List for Fifth Straight Year

InfoTrust Named to Inc. 5000 List for Fifth Straight Year

InfoTrust ranks No. 1,855 on the 2019 Inc. 5000 list with a 3-year revenue growth of 218%. BLUE ASH, OH – Inc. Magazine yesterday…

Are You Getting the Most Out of Your Google Analytics 360 Partner?

Are You Getting the Most Out of Your Google Analytics 360 Partner?

At InfoTrust, we are extremely proud as an organization to be a Google Analytics Certified Partner and Google Analytics 360 Sales Partner. It’s a…

It’s a Great Time To Be a Woman in Technology and Analytics

It’s a Great Time To Be a Woman in Technology and Analytics

I still remember my first job as a systems engineer in a bank. I was the only woman in the entire floor of the…

InfoTrust Earns Great Place to Work Certification for Third Straight Year

InfoTrust Earns Great Place to Work Certification for Third Straight Year

The InfoTrust team is thrilled to announce that our organization has once again been certified as a “Great Place to Work.” This is the…

Inc. Magazine: Why Entrepreneurs are Uniquely Positioned to Transform Our World

Inc. Magazine: Why Entrepreneurs are Uniquely Positioned to Transform Our World

InfoTrust’s CEO and co-founder, Alex Yastrebenetsky had the honor to attend the International Entrepreneurial Summit at the United Nations. This blog article was originally…

See How ITP, ETP and Other Browser Cookie Changes Affect Your Analytics

See How ITP, ETP and Other Browser Cookie Changes Affect Your Analytics

You’ve likely seen the abbreviation for Intelligent Tracking Prevention, ITP, strewn across the headlines of tech and marketing blogs over the past year. The…

Leave Us A Review

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