Stape

Mixpanel tag for server Google Tag Manager

Published
Sep 26, 2022
Also available in

Mixpanel is a popular analytics platform that allows you to measure user engagement and track conversions on your website or mobile app.

One of the most common ways to implement Mixpanel are direct integration to your site or using Google Tag Manager. Mixpanel integration using server Google Tag Manager might be a good solution if you want to increase page speed and set cookies more accurately. This guide will describe using our Mixpanel tag for the server GTM container. 

How Mixpanel tag for sGTM container worksCopy link to this section

Mixpanel server GTM template is available in sGTM Template Gallery

Mixpanel tag for sGTM can help you with these action types:

  • Track - tracks events in Mixpanel.
  • Alias - adds an alias to existing Mixpanel contact. Useful if you need to add a new identifier to the existing user.
  • Reset - resets identification of Mixpanel contact. You can use reset to manage multiple identities on the same device. When a user logs out, you can trigger a reset tag. It will reset the distinct_id and remove existing super properties. Mixpanel will treat subsequent events on the same device as performed by a new user.

Each action type of the Mixpanel tag has its own set of additional settings. 

Mixpanel tag for sGTM

Route data to Mixpanel's EU servers - select if you want to route data to the EU data centers. 

Automatically handle customer distinct_id - Mixpanel server API optimized for stateless shared usage; e.g., in a web application, the same mixpanel instance is used across requests for all users. Rather than setting a distinct_id through identity () calls like Mixpanel client-side libraries (where a single Mixpanel instance is tied to a single user), this API requires you to pass the distinct_id with every tracking call.

Send common data with request - Adds to track request user_agent, path, $current_url, $screen_width, $screen_height, $referrer, user ip, etc.

Get parameters from the variable - select if you want to extract any parameters from the sGTM variable.

Additional Parameters - select what other parameters you want to send and add Parameter Name and value.  

Remove parameters from the request - add parameters that you want to remove from the requests. Helpful in eliminating standard parameters like $current_url or IP.

 Logs Settings - select if you want to use stape logs to troubleshoot your setup.

How to set up the sGTM Mixpanel tagCopy link to this section

1. Add a tag to your sGTM using Template Gallery

2. Create a new tag. Select Tag Type (In this example, I will set up a tag type track since this one requires more configuration). Add your Mixpanel project ID (You can get the Project Token from project settings).

Select if you need to route data to EU servers and Automatically handle customer distinct_id.

Mixpanel server-to-server

3. Add event name. If you want to add common sGTM data to the Mixpanel request, you can also choose to parse parameters from variables. 

There is also an option to add or remove parameters from the request. Remove parameters is helpful when you select to add common data and need to remove some of the event data. 

set up mixpanel s2s integration

4. Add triggers and test your event.

Conclusion:Copy link to this section

Setting up Mixpanel tracking with Google Tag Manager is a great way to get detailed insights into how users interact with your site or app. Following the steps outlined in this post, you can quickly get started with sGTM and measure users correctly with long-lived cookies. 

Need help with setting up server-side tagging?

All it takes is a few simple questions. Click Get assistance, fill-up the form, and we will send you a quote.

Get assistance
Tagged with:sGTM tag

Relevant posts

Updated Oct 24, 2022

Sending Data From the Google Tag Manager Web Container to the Server Container

In this article, I want to show you how to use Data Tag. This custom tag sends parameters from the Google Tag Manager Web Container to the Server Container. When used together with the Data Client for the Google Tag Manager server container, it allows sending data layer variables, custom parameters, and other data from the web to the server container. As a result, Data Client retrieves information from the Data Tag into the Google Tag Manager Server Events.

Updated Feb 12, 2024

How to add a custom domain to the Google Tag Manager Server container

In this article, I will describe how to set up a custom subdomain within your Google Tag Manager server container. The main advantage of a custom subdomain inside the Google Tag Manager Server container is that it helps to bypass Intelligent Tracking Preventions, AdBlockers and increases cookie lifetime for users browsing in Safari. Pixels will be loaded from your subdomain and run as the first-party.

Updated Mar 21, 2024

How to set up Google Tag Manager Server Container

Collecting data about your website visitors is critical for analyzing and improving the online business presence, reaching users, and converting them into customers. However, collecting data is becoming more problematic because of Intelligent Tracking Prevention, AdBlockers, and a decrease in cookie lifetime. Google Analytics and other similar tools will start seeing fewer data about your website visitors and giving you less information to analyze.

Host your GTM server at Stape