What is the accumulated dataLayer state?
The accumulated state is the full dataLayer object as it stands after the push you selected. Scalpel Tags folds every earlier push in, using GTM merge rules, so you see the exact data a tag would read at that moment, not just the last push.
Why it matters
If you're trying to understand what data was available when a tag fired, the state is your source of truth. It's the complete picture of the dataLayer at that moment in time, with all the history folded in. A tag reads this state when it fires, so knowing what the state was is knowing what the tag could access.
How it works
Scalpel Tags reconstructs the dataLayer state by replaying every push up to and including the one you selected, using GTM's own merge semantics. Objects merge recursively; arrays replace wholly. The result is the exact state that existed after that push.
Here's what happens step by step:
- You select a push in the timeline.
- Scalpel Tags starts with an empty object.
- It applies the first push, merging the object in.
- It applies the second push, merging again.
- It continues through every push up to your selected one.
- The result is the full state object.
One detail: gtag's internal arguments are not merged into state. If a push looks like it came from gtag() (it has the gtag argument structure rather than a custom push), it's skipped in the fold. This keeps the state view clean and aligned with what GTM actually sees in its own state management.
What does not matter
The state view does not show whether a push has been replayed or is live. Both appear the same in the state. Also, a very deeply nested state might be capped at a reasonable depth to keep the display readable; if you have an object twenty levels deep, the UI might truncate it. But for real-world tracking data, this is rarely an issue.
Code example
// Push 1: event fires
dataLayer.push({
event: 'page_view',
page_type: 'product'
});
// Push 2: ecommerce data arrives
dataLayer.push({
ecommerce: {
items: [
{ item_id: 'SKU123', item_name: 'Shoe', price: 79.99 }
],
value: 79.99
}
});
// Push 3: price discount
dataLayer.push({
ecommerce: {
value: 69.99
}
});
// State after push 3 is:
// {
// event: 'page_view',
// page_type: 'product',
// ecommerce: {
// items: [{ item_id: 'SKU123', item_name: 'Shoe', price: 79.99 }],
// value: 69.99
// }
// }
//
// The items array stayed, the value changed.
How Scalpel Tags shows it
In the dataLayer tab, click any push to expand it. You'll see a State panel alongside the diff. The state shows the entire object as it stands after that push, formatted as JSON. Expand or collapse sections to read nested objects. This is the complete picture, everything GTM would know about at that moment.