How to insert Google Analytics and Tag Manager in Twenty Twenty Four WordPress Theme?

I have been doing mostly marketing for a few years and looks like editing header.php is not really an option anymore? What is the best true way? Without unnecessary plugins if possible.

5 Comments
  1. Any good SEO extension should do it for you. I like RankMath best myself, but there are plenty to choose from. They will also do other useful stuff too. I know you said without plugins, but you get so much benefit from a good SEO plugin, it’s well worth adding.

  2. While SEO plugins can do the job for you, I would go with Sitekit. It’s the official app from Google, and it has a nice dashboard to show you the performance. It also allows you to connect GTM container, and I haven’t confirmed it, but pretty sure it will prevent you from having double entries.
    that’s the easiest way to go with no code.

  3. If you don’t want an additional plugin create a child theme and create a function to add the GTM jS container to the head.

    However I would recommend you look at GTM4WP plugin which has a very rich data layer and super helpful features.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer