GA4 with Data Tag & Data Client - All revenue goes to traffic source: Unassigned

Dear Stape Community,

following the blog guides and the valuable advice of the community I configured the GA4 server side tracking both with the official tags and using Data Tag and Data Client sending the data to two different properties in order to make the comparison:

  • GA4 - Server-Side tracking with official GA4 tags with data sending to GA4 property: GA4 - Server Side - Official
  • GA4 - Server-Side Tracking with Data Tag and Data Client + Official GA4 Configuration Tag with sending data to the GA4 property: GA4 - Server Side - Data Tag

below I report the configuration:

PROPERTY: GA4 - Server Side - Official

WEB container:

SERVER container:

PROPERTY: GA4 - Server Side - Data Tag

WEB container:

SERVER container:


In the GA4 - Server Side - Data Tag Property by going to:

GA4 > Acquisition > Traffic Acquisition

All revenue is reported as unassigned with a single session:

While in the GA4 - Server Side - Official property the revenue is assigned to different traffic sources:

Since we use Google Ads as the main source of traffic, all links are tagged using both auto-tagging with GCLID and UTMs. An example of a link is the following:{ifsearch:cpc}{ifcontent:display}&utm_network={ifsearch:search}{ifcontent:display}&utm_campaign=USA+-+EN+-+USD+-+Apple+-+Hyperion+Slim&utm_id={campaignid}&utm_adgroup=USA+-+EN+-+USD+-+Apple+-+Hyperion+Slim+-+US287v18847EN+-+AWSE+-+Champagne&utm_term={keyword}&utm_content={creative}&network={network}&device={device}&devicemodel={devicemodel}&campaignid={campaignid}&adgroupid={adgroupid}&keyword={keyword}&matchtype={matchtype}&creative={creative}&adposition={adposition}&feeditemid={feeditemid}&extensionid={extensionid}&placement={placement}&target={target}&targetid={targetid}&loc_interest_ms={loc_interest_ms}&loc_physical_ms={loc_physical_ms}&merchant_id={merchant_id}&store_code={store_code}&product_channel={product_channel}&product_language={product_language}&product_country={product_country}&adtype={adtype}&product_partition_id={product_partition_id}&product_id={product_id}

Where the values ​​in curly brackets are automatically populated by Google when a user clicks on an Ad and the GCLID is also attached to this link.

After several hours of debugging, I noticed that sending the pageview with Data Tag, the events:

  • session_start
  • first_visit
  • user_engagement

are not sent to GA4 possibly compromising the number of sessions and the correct attribution of the traffic source.

Therefore, I wonder how to properly configure the page view event in GA4 using Data Tag and Data Client in order to avoid AdBlockers and correctly track the source of traffic.

A thousand thanks.

You are correct that events like session_start, first_visit, user_engagement are not collected by the Data tag. As Data tag does not use automatic events firing like gtag.js you need to configure all events manually.

Problem with one session probably because you did not configure client_id as described in this blog post. (Step 10) Avoid Google Tag Manager blocking by Adblockers - Stape

Also, please check to add GA id inside GTM WEB container. (Check screenshot)

We recommend using the Data tag only as a backup for GA4 tracking. Usually, we use default setup with official tags and add additional custom purchases events with the Data tag. In this way, you will have the most accurate data.

1 Like

Thanks for the reply Denis.

1) [GA4] Automatically collected events

In the google documentation at the following link:

Report how these events are triggered:

Event: session_start
Trigger: when a user engages the app or website
Parameters: nothing

Event: first_visit
Trigger: the first time a user visits a website
Parameters: nothing

Event: user_engagement
Trigger: when webpage is in focus for at least one second
Parameters: engagement_time_msec

I will try to replicate them manually, session_start and first_visit must be activated only at the first pageview and I found a guide to do this:

While for user_engagement I should create a temporal trigger that is activated after one second.

2) Client id

I set the client_id following the second blog post option:

use client_id that Data Tag generates. In this case, you will need to enable “Always generate client_id parameter” in the Data Client in the server container

as shown below:

in the GA4 tag on the SERVER do I still have to insert the client_id? If so, since there is no “Enable override fields to set” option in the GA4 tag, how should I insert it?

3) GA4 ID

Also, please check to add GA id inside GTM WEB container. (Check screenshot)

I added now as you told me the GA4 ID in all the Data Tag tags in the WEB container.

4) Custom purchases events with the Data tag

I set up server side tracking with the official GA4 tags and among these there is also the purchase event:

Should I add another purchase event with Data Tag and Data Client in addition to the official one and send the events to the same property? If so, how do you manage the duplication of purchase events?

A thousand thanks.

If you use a custom domain, then this checkbox will be enough.

You used the “purchase” event name in the GA4 tag and “purchase_backup” in the Data tag. In both events, send transaction_id (the id of your purchase or order). Then you can deduplicate events in BigQuery or use purchase_backup in reports of DataStudio.

You can use a similar approach for other events. But we usually use this only for purchase and lead events (from submits).

1 Like