Hello Stape team and community,
I am implementing a clean GTM setup using Stape’s server-side and client-side templates, and I want to ensure that event deduplication works seamlessly between server-side and client-side events. Here’s an outline of my current setup and workflow:
Setup Details:
Client-Side Implementation:
I’ve configured a clean GTM Web container with Stape’s templates.
All required events (e.g., purchase, add to cart) are implemented using {event_name}_stap, and the generated JavaScript includes all the necessary data sent to the GTM client-side endpoint.
in gtm preview i see that everything looks correct.
window.dataLayer = window.dataLayer || ;
window.dataLayer.push({
‘event’: ‘view_item’,
‘event_id’: ‘view_item_2656233532315646’,
‘item_id’: ‘ITEM12345’,
‘item_name’: ‘Road Bike’,
‘category’: ‘Bikes’,
‘price’: 799.99,
‘currency’: ‘USD’,
});
Server-Side Implementation:
I’ve installed the PHP SDK and am sending the same events from the server-side endpoint with identical data payloads, including:
$data = array(
‘event’ => ‘view_item’,
‘event_id’ => ‘view_item_2656233532315646’, // Unique ID for this view_item event
‘item_id’ => ‘ITEM12345’, // Product ID
‘item_name’ => ‘Road Bike’, // Name of the item
‘category’ => ‘Bikes’, // Category of the item
‘price’ => 799.99, // Price of the item
‘currency’ => ‘USD’, // Currency of the transaction
);
I’ve ensured that both server-side and client-side events are sent with the same event_id for deduplication purposes.
Power-Up Configuration:
I’ve enabled the Cookie Keeper power-up to retain the required cookies and ensure accurate event association.
My Goal:
I want to verify that all events are deduplicated correctly to prevent duplicate reporting in tools like GA4.
trying to see the events in the web preview i see event_name_digits as i sent.
trying to see the events in the server preview i see digits_digits and not event_name_digits
Specific Questions:
-
Is it sufficient to include an identical event_id (e.g., ‘event_id’ => ‘ITEM2656233532315646’) in both the server-side and client-side events to enable deduplication?
-
Are there any additional cookies, that need to be sent or included to assist with the deduplication process?
-
If cookies are required, which?
-
Are there any additional best practices or configurations I should implement to ensure deduplication works consistently in my setup?
I want to ensure I’ve covered everything to avoid potential issues with duplicate events across client and server environments. Any detailed guidance or best practices would be greatly appreciated.
Thank you for your help and for the amazing tools you provide!