Using Data Client to fire GA4 tag

Hi,

I have found the data client is better at parsing the data from the client side container and building this in the event-data model. When we use the data client we receive the items object from the datalayer for purchases which we do not with the GA4 client. So I am thinking about just using the data client for everything instead. The problem is that when using the data client to trigger the GA4 tag . the data is not sent to the correct GA region.

The data tag sends it to https://www.google-analytics.com/g/collect

The correct region should be https://region1.google-analytics.com/g/collect
like here:

Any ideas how I can change this? Is it a setting in stape itself?

Thanks in advance for any help

I would not recommend using Data tag - Data Client to send data to GA4 or any Google platforms (Floodlight / Google ADS etc).
Google tag automatically collects some events and generates quite a lot of automatic data that is needed for correct operation of GA4 / Google ADS etc. So it is unlikely that you will be able to replicate this completely and the quality of your tracking will suffer a lot.

Data tag - Data Client is a great source of data for any non-Google tags (Meta, TikTok, Klaviyo, etc.).

As per your questions - GA4 itself determines which endpoint to send data to, you can’t influence this and Stape can’t influence this either.

thanks for the reply.

the main reason for using the data client/tag was that we have some events with parameters as arrays which the GA4 tag/client does not seem to recognise whereas the stape one does.

For example this one:


Any ideas how we can get the server side GA4 tag to recognise this data so we can forward it on to GA4/big query?

@Jack_G JSON.stringify them, and then JSON.parse on the server

See this thread towards the middle: Best Consent Logic for SST & Data Tag? - #4 by Alex

Hi dan, thanks a lot. using this template worked perfectly