With valuable insights into how customers interact with your site, you can track user trends, optimize responses to provide better customer experiences, and ultimately gain a competitive advantage in the ever-evolving digital landscape. With all of this in mind, using server-side Google Analytics 4 for WordPress has become increasingly popular due to its accuracy and ease-of-use.
This blog post will explore the advantages and setup of server-side Google Analytics 4 for WordPress sites with a GTM server side plugin and help identify ways it can benefit your clients’ marketing efforts. Let's take a look at why you should seriously consider implementing server-side Google Analytics 4 into each WordPress site you manage!
The main benefit of server-side Google Analytics 4 implementation over the client-side is that ss GA4 configured using sGTM using a custom domain sets 1st party cookies.
WebKit browsers (Safari, Firefox, etc.) limit 3rd party cookies lifetime to 1 or 7 days. Client-side GA4 implementation sets 3rd party cookies. It means that if a users view your website from any browser built on the WebKit, client-side GA4 cookies will live 7 days maximum.
Conversely, with ssGA4 and sGTM using a custom domain, cookies will be set from the subdomain located within the main domain and considered 1st party. 1st party cookies are not affected by WebKit yet and will live up to two years. However, there are some plans to limit the life of 1st party cookies set from the third-party IPs.
Server-side provides an additional layer of privacy and security for sensitive information. This can be particularly important for organizations that collect personally identifiable information (PII) or financial data. By processing data on the server, businesses can reduce the risk of exposing sensitive data to potential security threats, ensuring that data is collected and processed in a more secure and protected manner.
Сomply with data protection regulations, such as the General Data Protection Regulation (GDPR) and the California Consumer Privacy Act (CCPA). Ensure that you are collecting and processing data in compliance with applicable regulations.
In the summer of 2022, several European countries (France, Denmark, Italy, etc.) concluded that using Google Analytics 4 is illegal since it transfers the personal data of EU users to the US. One of the solutions for the legal use of GA4 in these countries is server-side GA4 which uses a European proxy server.
1. Go to https://tagmanager.google.com/ and log in to your Google Tag Manager account.
2. Click on the "Admin" button, and under the "Containers" column, click the "+ Create Container" button.
3. Choose a name for your server container, select "Server" as the type of container, and click the "Create" button.
4. Select the option to "Manually provision tagging server," and copy the container configuration that appears. Save this configuration in a text editor as you will need it later.
5. Log in to your account on our service or create a new account if you haven't already.
6. Once you're logged in, click on the "Create Container" button. Give your container a name, paste the Container Configuration that you copied from your Google Tag Manager Server Container, and select the server location. Click "Create Container."
7. Wait for around 5 minutes for the server container to deploy. Refresh the page to update the status. If the setup was done correctly, you should see the status "Running." If you see "Error," double-check that you've copied the correct container configuration. Contact support if the error persists.
8. In this step, you need to set up a tagging URL.
You have two options:
If you choose to go with the first option, move to step 9.
If you want to configure a custom tagging URL, click "Add domain" under stape provided tagging URL -> log in to your domain name service and create a new DNS record for the subdomain you want to use. You can use any subdomain name you want.
Add these settings:
Type: A
Name: ss (or any other subdomain name you want)
IPv4 address: IP address depends on the location of the servers. You can find the custom domain IP address in your stape.io account.
TTL: Auto
Proxy status: disable
Your settings should look like this:
9. You can enable the Global CDN feature for the server container, which uses Cloudflare technology to load js files from a server closer to your site visitors, resulting in faster js file serving and better page speed. Consider your country's privacy regulations before enabling this feature. Add a CNAME record to make Global CDN work.
Consider your country's privacy regulations before enabling Global CDN.
After you've enabled Global CDN you will need to add CNAME record to make Global CDN work.
10. Add the tagging server URL to the Google Tag Manager Server container by going to "Admin," then "Settings," and selecting "Container Settings.”
1. Log into your WordPress Admin, and go to the plugins. Then, click “Add New,” type “GTM Server-Side,” choose this plugin, and click install now. Once established, click Activate.
2. Open the GTM Server-Side plugin you installed in the first step and paste tagging URL inside the plugin settings. Next, select if you want to add web GTM to all site pages or just add plugin functionality without adding GTM script (this option should be used in case you are using any other plugin that inserts GTM script on the site). Next, add WEB Google Tag Manager ID, tagging server URL, and stape container identifier if you want to use a custom loader.
3. If you have an eCommerce website and want to push ecommerce events and user data to the Data Layer, click on the second tab of the plugin and enable two checkboxes. Note that it can work only with woocommerce shops.
1. Inside the Web container, create a new tag of the tag Type Google Tag. Add your Google Tag ID.
In the section Configuration settings add the following parameters:
Add trigger to GA4 tag. Normally it should trigger on all page views.
You can also create a Google tag: Configuration settings variable that will predefine Google Tag settings if you need to use multiple Google Tags on your website and do not want to add settings for each of the tags manually.
These parameters can be, for example, a setting that defines whether you want to send a page view event every time a Google Tag triggers, set UTM parameters, client ID, etc. There is a list of standard Google Tags configuration parameters.
2. To set up the GA4 event, go to the tags section and create a new tag with the tag type Google Analytics: GA4 Event. Add your GA4 ID and the event name; there is a list of standard event names.
You can create a Google Tag: Event Settings variable that will help to share event parameters across several GA4 event tags or Google Tags. It can be, for example, user or product properties, and there is also a list of standard parameters for event settings.
3. Open Google Tag Manager Server container -> click Client -> create GA4 client and save it -> go to Tags and set up GA4 tag. Remember that GA4 automatically sends not only pageview but some other events. Inside Event Name choose variable {{Event Name}}. -> add trigger Client Name equals GA4.
4. Open the Server container preview mode and check that you see GA4 requests. Publish updated inside server and web Google Tag Manager containers.
In conclusion, anyone can gain valuable insight into their customers' site interactions and use this to optimize the customer experience and gain a competitive advantage. GTM server side plugin for WordPress has made it much easier and more accurate than other methods of tracking user data.
If you have any questions left or just want some help with the setup of Google Analytics 4 for WordPress, do not hesitate to contact the stape support team.
We've got you covered! Click Get assistance, fill-up the form, and we will send you a quote.