Piwik PRO Day is a virtual event during which analytics and digital marketing experts share their knowledge and provide insights into developing better data-driven strategies.
In one of the sessions, Simo Ahava discussed server-side tagging and one of its capabilities – data stream consolidation. He provided a step-by-step guide on expanding a single GA4 data stream into multiple outputs and shared best practices for using it.
In this article, we provide a transcription of the session and explain the process of data stream consolidation.
Learn more about server-side tagging:
What is server-side tagging
Server-side tagging refers to implementing and managing tracking tags on a dedicated tag manager server. For example, you can use the server-side Google Tag Manager to receive data from the client-side tracker, process it, transform it if needed, and send it to different vendors and tools, such as GA4, Meta Conversions API, and others.
Server-side tagging offers additional capabilities, such as data validation and enrichment, data redaction, and data stream consolidation.
Data stream consolidation
Data stream consolidation is one of the key features of server-side tagging. It involves taking one incoming data stream, such as GA4, Piwik PRO, Stape, or others, and distributing it to many outputs. Instead of sending the same event to different vendors – for example, when a customer adds an item to a cart – you send it to the server container, which distributes the event to various platforms.
Because you run all the logic on the server side, you get to keep the client-side tracker lightweight and maintain better performance. You can also control your data streams, which is one of the essential things about server-side tagging.
Let’s go through the process of expanding one data stream into multiple outlets, including GA4, Meta, and Piwik PRO.
GA4 and sGTM
We are using the Google Analytics 4 (GA4) client-side tracker. GA4 hits are sent from the browser to server-side Google Tag Manager (sGTM), which then forwards them to Google Analytics 4. One of the benefits of server-side GTM involves maintaining control over what data Google receives.
If you use Meta Ads, you may want to collect a Facebook conversion whenever a purchase is made. You have two options for tracking this information:
- Collect data in the browser through the Meta pixel.
- Add a Facebook Conversion API tag to server-side GTM and use it to collect purchase data for the Conversion API.
The latter provides privacy and security benefits by not communicating with Meta’s domains from the user’s browser. You can manage what is sent to Meta instead of Meta having full control via the pixel.
Regarding data stream consolidation, you won’t add any client-side code or tags. Instead, you will use the Meta Conversion API event to “piggyback” on the GA4 purchase event.
To do that, you need to do the following:
- Install the Facebook Conversion API template created by Stape.
- Create a new Facebook Conversion API purchase tag.
- Add a GA4 purchase event as a trigger.
The Facebook purchase tag fires after the purchase event comes in from GA4. The tag parses data from the incoming GA4 event into the purchase event. You now have a single GA4 data stream coming to the website and sending it to both GA4 and Facebook for specific events.
Let’s say you want to add additional information to the purchase event, such as a user’s email address, but don’t want to share it with Google Analytics. In that case, you can apply a transformation to strip out specific parameters from some of our tags.
For example, you can apply an “Exclude parameters” tag transformation and remove the parameter’s user data and event ID from any tag that isn’t Facebook.
This way, you ensure that specific user data is not available to other tags, such as Google.
Experts opinion
Simo Ahava
Co-founder at Simmer, Partner at 8-bit-sheep
Transformations are a great way to ensure that only some of your tags can carry the parameters you set on the client side. This is a canonical way of doing data stream consolidation.
Piwik PRO
Now, you want to use a different analytics platform, such as Piwik PRO Analytics Suite, but re-tagging the entire site would take too much time. Instead, you can run GA4 on your website and transcribe its data stream to the Piwik PRO format.
To do that, you need to:
- Install the Piwik PRO tag template, built together with Simo Ahava.
- Create a new Piwik PRO tag.
- Add a GA4 page view event as a trigger.
Since this is not a Facebook tag, the previously created transformation is applied automatically. As a result, the user data object and the event ID are not included in this Piwik PRO hit.
After the page view event comes in, the tag fires.
Here, you can see the page view event collected by GA4:
The data is collected and transcribed to Piwik PRO:
You are using the incoming GA4 stream and sending that data to Piwik PRO.
Without almost any customization of the Piwik PRO tag, all information is collected and automatically parsed from the GA4 event. You can see data about different events. For example, you have ecommerce data – like the product detail view, such as the add-to-cart and user-specific information.
Experts opinion
Simo Ahava
Co-founder at Simmer, Partner at 8-bit-sheep
The Piwik PRO template we built with Piwik PRO is really good for taking the GA4 stream and automatically converting it to a Piwik PRO event. I’ve been running it on my blog for months now, and I can see the results really nicely. My Piwik PRO data is almost one-to-one, so if I were lazy, I wouldn’t even have to touch GA4. I could just keep GA4 running client-side and then use Piwik PRO server side.
You can also create similar data streams for other vendors. For example, you can add tags for Amplitude, Snowplow, TikTok, Pinterest, and dozens more.
Best practices for data stream consolidation
There are some principles you need to follow when using data stream consolidation.
1. Use a broad client-side stream
Start with a stream that provides access to a broad range of information, then narrow it down server-side to only the events you are interested in.
Analytics libraries, like Google Analytics 4 and Piwik PRO, are great for incoming data streams because they collect a lot of data that can be used for behavioral analysis, data warehousing, conversions, audience building, and so on. These streams are dedicated to comprehensive measurement and are great for various server-side tagging pipelines.
Using a client-side conversion pixel for server-side measurement, you can gather data on conversions and build audiences. However, this method doesn’t work for broader data collection – for example, you won’t measure scroll or page view events.
You can also consider implementing a custom solution, such as image requests and HTTP dispatch. For example, Stape has an excellent client data tag combination. While these solutions are suitable for all kinds of pipelines, they might require extensive customization and re-tagging of the site because they must be created specifically for server-side tagging.
2. If you’ve already tagged the site with GA4, use it as the data stream
If you’re already running GA4 client side, keep using it for server-side GTM. By using GA4, you’re already producing data in the correct format for server-side GTM.
GA4 also has a multipurpose data model, like Piwik PRO, so it’s well-suited for different use cases, such as ad integrations, audience building, conversion measurement, behavioral analytics, and more.
3. Enrich client-side, trim with transformations server-side
Suppose you want vendor-specific information on the server side. In that case, you need to perform client-side data enrichment and apply server-side transformation to remove all the unnecessary information from other tags.
Like in the example above, you must add information to the GA4 tags even if you don’t want to collect it for GA4. The server-side Facebook tag can’t generate them if they’re not included in the incoming GA4 stream. This is one of the downsides of data stream consolidation.
Transformations are available to ensure all Facebook-specific parameters are automatically excluded from any tag that isn’t Facebook.
4. Use trusted templates
In most cases, a trusted template will be built by the vendor, such as Pinterest, Vimeo, Piwik PRO, Amplitude, Quantcast, Snap, and TikTok. Another thing to look at is when the template was last updated – if it was two or three years ago, it may have been abandoned.
Conclusion
You’ve just learned how to use a detailed client-side GA4 data stream and add different tags in server-side tagging, all “piggybacking” off the GA4 data. You may still need to add customizations to your server-side tags, like specific parameters, transformations, or event names that the template might not automatically recognize.
To learn more about data stream consolidation in server-side tagging, watch the full session conducted by Simo Ahava on Piwik PRO Day:
Improve data control and quality with server-side tagging and tracking
Explore options for implementing server-side tagging and tracking with Piwik PRO’s own solutions and integrations with our partners.