Stape
Search
Try for free

GTM best practices and tracking tags for 2025

Published
Mar 14, 2025

Google Tag Manager is a popular tool for efficiently managing tracking scripts. In this article we will show you:

  • Top tracking tags for web and server GTM containers that will help track campaign performance and user behaviour.
  • List of best GTM practices, including but not limited to setting up the Data Layer, implementing allow and deny lists, and using AMP.

So, let’s get started!

What is Google Tag Manager?

Google Tag Manager is a tagging tool that simplifies tag management. It allows you to configure and control tags on your website without directly modifying its code. It is like a command center where you can manage and set up data tracking.

Its configuration is straightforward and requires creating a GTM container and inserting two snippets on each website page. For the purpose of this article, we will consider both web and server GTM containers.

Tags for analytics tools

Google Analytics

Type: web and server

Google Analytics 4 remains one of the most popular analytics tools. Using tags, you can set up pageviews, traffic, and events such as button clicks, scrolls, and downloads. That's an essential tag for gathering insights into user interactions and behavior on your website.

The tag is available for both web and server GTM containers. It is found when you choose the tag type when creating a new tag.

Check out our detailed guide on how to set up Google Analytics 4 for server GTM container.

Google Analytics tag

Mixpanel

Type: web and server

If you use Mixpanel for data tracking, a few tags are available for web and server GTM containers. Both communicate with Mixpanel API allowing you to implement Mixpanel through the Tag Manager interface rather than directly in code. 

Mixpanel has developed a Mixpanel tag for web containers, which can be found in the GTM template gallery.

Mixpanel tag for web container

As for the Mixpanel tag for server GTM container, you can use the one developed by Stape. For the detailed set up guide, please check our article on configuring the Mixpanel tag.

Mixpanel tag for server GTM configuration

Matomo

Type: web and server

Matomo became even more popular after Google Universal Analytics sunset. It is a free, open-source platform that provides tools to track user interactions on a website. If you use Matomo for data tracking, there are numerous GTM tags can facilitate the tracking process.

As for the tag for web GTM container, Matomo Analytics - Actions tag is the most versatile as it includes the tracking of different actions (page view, events, goals, links and site searches) compared to other available tags that are focused on the specific actions tracking.

Matomo tag for web GTM container

If you are using server GTM container, try Stape's Matomo Advanced tag. With its help, you can track pageviews and events, including e-commerce. Check our article on tag configuration for more details.

Matomo Advanced tag for server GTM

Type: web and server

Google Ads Conversion Tracking tag is crucial for evaluating the performance of your Google Ads campaigns. So, you can refine your Google Ads strategy. In addition, if you run remarketing campaigns, you should add Google Ads Remarketing tag.

Similar to the Google Analytics tag, the Google Ads Conversion Tracking and Remarketing tags can be found in web and server GTM containers when you select the tag type.

We have a detailed guide for setting up server-side conversion tracking in Google Ads, including configuring Enhanced Conversions and remarketing tracking.

Google Ads Conversions tag in GTM

Facebook tracking

Type: web and server

Depending on your tracking method (client-side or server-side), there are two data gathering tools: Facebook Pixel and Facebook Conversions API. Both have the same purpose - gathering data on Facebook and/or Instagram ad campaigns.

If you are using a web GTM container, you can opt for the Facebook Pixel tracking tag from the GTM template gallery. After adding the Meta Pixel script to your website, you can effectively manage data collection with this tag.

Example of Facebook Pixel configuration

For the server GTM container, you can use the Facebook Conversions API tag developed by Stape. Please note that Meta recommends tracking events using Facebook Pixel and Conversions API, so you must also set up event deduplication for precise data tracking.

Example of Facebook CAPI tag configuration

LinkedIn tracking

Type: web and server

Similar to Facebook, LinkedIn has a tracking pixel. GTM templates will facilitate data tracking if you run LinkedIn ads.

For a web GTM container, you can use LinkedIn InsightTag 2.0 after adding tracking code to the website. However, some users notice that the tag's performance slows down website load, so it's worth doing website speed testing before and after implementing the tag.

If you are using a server GTM container, try the LinkedIn Conversion API. Integrating the Conversion API will improve your web pixel tracking and make it more resistant to ad blockers and the latest ITP updates. Check out our guide on setting up the LinkedIn Conversion API Tag for server GTM for more details.

LinkedIn CAPI tag configuration

Email marketing tags

Most email marketing services don't have their own rebuild GTM templates, especially for web GTM container. So, in the sections below, we consider the available templates for the most popular platforms. If there is no template for a web GTM container, creating a custom HTML tag that fits your needs would be a good solution.

Mailchimp

Type: server

Mailchimp Event Track is a tag that works for the server GTM container. With the help of a tag you can track events and create or update contacts. Check how to connect your website to the Mailchimp using a tag.

Mailchimp tag configuration

Klaviyo

Type: web and server

Integrating your site with Klaviyo is crucial if you run email campaigns. By sharing data with Klaviyo, you can better segment lists, automate campaigns and send personalized emails.

Klaviyo Identify is a tag for a web GTM container that sends user identification to Klaviyo. In most cases, it can be more convenient than custom HTML.

The Klaviyo tag can be used for the server GTM container. It allows you to add new users, track user activity on the website, and send events and parameters. For details, see the detailed guide on how to set up the Klaviyo tag.

Klaviyo tag configuration

Brevo

Type: server

Like Mailchimp, integrating with Brevo using a prebuilt template is only possible for the server GTM container. To create such an integration, use the Brevo tag. The Brevo server GTM tag allows for the tracking of events, page views, link clicks, and user identification.

Brevo tag configuration

SendGrid

Type: server

SendGrid is a popular solution for those needing to send large emails. Similar to other email marketing services, SendGrid has a prebuilt template for a server GTM container only. The SendGrid template allows sending messages from SendGrid and adding/updating contacts using the server GTM container.

For a detailed guide on how to set up SendGrid tag check our guide.

SendGrid tag configuration

12 Best Google Tag Manager practices

Create scalable naming system

Creating a scalable naming system for GTM tags, triggers, and variables is essential for maintaining clarity and consistency as your website grows and the number of these elements increases.

The best practices for naming GTM elements include:

  • Create unified naming rules. The tags/triggers/variables names should include the key data on a specific element's purpose and additional information required if someone works with it later.
  • Categorize elements. They can be logically divided into groups, such as the behaviour metrics setup and e-commerce tracking. Use descriptive suffixes and prefixes to differentiate them.
  • Keeps records. Notes significant changes and container setups so that someone else can refer to them in the future if necessary.

We have prepared the table that may help you structure your naming system for tags, triggers, and variables:

GTM elementTool/TypePurposeExample
TagGA4PageviewGA4 - PageView
FBAdd to cartFB - AddToCart
GAdsPurchaseGAds - Purchase
TriggerCustom eventAdd payment infoce - add_payment_info
Page view - DOM readyPageviewdom - page_view
All elements/Just links clickClick “Register” buttonclick - register_button
Variable1st Party CookieTracking email subscriberscookie - email_subscriber
Custom JavaScriptTrack the event’s timestamp, which will be sent to GA4cjs - ga4_event_timestamp
Data Layer VariableCurrency trackingdlv - ecommerce_currency

Avoid loading all scripts with a tag manager

GTM isn't the best choice for loading visual or functional elements of the website, such as cookie banners or hero images. Relying on a tag manager for these elements can introduce delays, negatively affect user experience, and increase metrics like LCP and CLS in PageSpeed Insights. So, using third-party solutions to set up such elements is better.

Set up Data Layer

Data Layer is a more advanced concept for data tracking, but it is often omitted. It helps you set up flexible event tracking and ensure reliable data collection. In addition to tracking specific elements of your website that auto-event listeners can't capture, you can create a stable source from which the GTM container retrieves data instead of relying on HTML DOM.

Our guide on Data Layer covers its use cases, set up process, testing, troubleshooting, and more.

Use constant variables

Constant variables are helpful if you need to enter specific data (such as GA4 Measurement ID or Pixel ID) multiple times for different tags. If you need to change this data, you can adjust it only in one place (constant variable), and the changes will be applied to all the tags.

You can create constant variables by going to Variables → New → "Constant" as the Variable type.

Constant variable in GTM

You can also use Stape's pre-built templates for different platforms. Please note that they are created for both web and server GTM containers. Here is the list of platforms we have prebuilt templates for:

Pre-built templates include tags, triggers, and GA4, Meta, and Google Ads variables. As for the constant variables, you will receive the template where you just need to put your value:

Pre-built template by Stape

Reduce the number of custom HTML tags

Custom HTML tags are a flexible solution for setting up custom data tracking. They allow you to add tracking scripts to the page, but in some cases, having many such tags may result in layout shifts.

When this element is inserted, the browser must recalculate the size and position of all elements on the page. Frequent recalculations can degrade website performance.

Custom HTML tag

When possible, use templates from the GTM template gallery. Custom templates operate within a sandboxed JavaScript environment. They are optimized to work more effectively with your website's Content Security Policy (CSP), which helps website developers restrict potentially harmful actions JavaScript can perform on a site.

Implement allow and deny lists

Allow and deny lists are used to restrict certain tags, triggers, or variables on the website. This can be helpful for security. For example, prevent GTM users from adding specific tags to maintain code stability or control data collection.

Implementing allow and deny lists is done through the Data Layer. You can find more details on the setup in Google's documentation.

<script> window.dataLayer = window.dataLayer || []; dataLayer.push({   'gtm.allowlist': ['<id>', '<id>', ...],   'gtm.blocklist': ['<id>', '<id>', '<id>', ...] }); </script>

Discover Accelerated Mobile Pages (AMP)

Accelerated Mobile Pages (AMP) in GTM are designed to provide a fast and smooth browsing experience for mobile users, making them especially beneficial for businesses with a large share of mobile traffic. Implementing AMP requires additional setup - such as creating a container and configuring page variables - but the effort is worthwhile for those looking to track mobile user data without compromising performance.

AMP in GTM

Monitor PageSpeed Insights

When you make bulky updates in GTM, such as adding multiple elements, especially custom HTML tags, check how they affect website performance. Every additional piece of code may negatively impact page speed. So be sure to roll back the GTM updates if you see a negative impact on the website performance.

Often, the problem can be in the JavaScript files of GTM that impact the page load time.

Third-party code in pagespeed insights

Conduct container audit

Regularly reviewing GTM is the best practice for maintaining an efficient and error-free setup. Auditing the GTM container will allow unnecessary elements to be deleted, resulting in faster website load.

For this purpose, you can use GTM Tools, which was created by Simo Ahava and relaunched and fully supported by Stape some time ago. With its help, you can conduct a comprehensive container audit, visualize container set up, delete or clone specific elements.

GTM tools by Stape

Test with other tools

In addition to testing set up via GTM, it is worth double-checking it in other tools. For example, if you configure tracking for Google Analytics 4, use its DebugView. For manual real-time configuration check and troubleshoot use Tag Assistant. This way you can be sure that the tracking you've configured works smoothly.

If you are using Stape, you can also try our Monitoring feature. With its help, you can easily monitor your GTM setup, as when developers update the website, some actions can negatively affect data tracking or break it.

Monitoring feature at Stape

Make GTM preview easier to navigate

Reading data can be tricky, and navigating the preview can become overwhelming in large containers with multiple active tags. To make a GTM preview navigation more manageable, use browser extensions such as Stape GTM Helper.

GTM Helper extension will allow you:

  • Improve clarity of incoming and outgoing JSON requests with the JSON formatter.
  • View query parameters in URL requests using the Request URL formatter.
  • Navigate popular tags (Meta, GA4, Google Ads, Microsoft, etc.) with color-coded types and statuses.
  • Verify consent statuses in server GTM to troubleshoot tag-related issues.

Consider using server-side tagging

If you don't use server-side tracking instead of client-side tracking, switching to it is worth considering, especially in the age of data regulations and the need for greater control over the data to comply with them. This approach removes vendor code from the client and shifts processing from the client to the server.

Server-side tagging is highly flexible in setup and provides numerous benefits, including resistance to ad blockers and browser restrictions such as ITP, security, and data control.

How server-side tracking works

Conclusion

In this article, we have listed tags that will work for web and server GTM container. They will be enough to track the different platforms' performance and on-site behaviour. By using best practices such as structured naming conventions, reducing the number of Custom HTML tags, prioritizing tag sequencing, and implementing server-side tracking, businesses can maintain a well-organized and high-performing GTM setup that doesn't affect website performance. Additionally, server-side tracking provides improved data control and security. Regular audits and performance monitoring with GTM Tools ensure efficient data tracking configuration.

Comments

Try Stape for all things server-sideright now!