I’m currently working on pushing ecommerce and non-ecommerce dataLayer events to GTM + GA4 setup.
My goal is to ensure that when event parameter values are unavailable, they appear as empty cells in GA4 rather than '(not set)'.
For non-ecommerce events, I can modify the event parameters within GTM to handle missing values. For ecommerce events, I rely on the built-in checkbox (send ecommerce data) in GTM to send the ecommerce object, which limits my ability to alter the parameters.
What would you recommend as the best approach to avoid (not set) in my ga4 reports?
Will passing "", undefined or omitting the parameter result in empty cells or show up as '(not set)' in GA4 reports?
If my developers either pass an empty string '', undefined, or completely omit a parameter from the dataLayer when certain values aren’t available. will this work?
For example:
//non ecommerce dataLayer
dataLayer.push({
event: 'custom_event',
user_category: '', **// Option 1**
user_location: undefined, **// Option 2**
});
// ecommerce dataLayer where 'item_variant' is omitted
dataLayer.push({
event: 'purchase',
ecommerce: {
transaction_id: 'T12345',
affiliation: '', **//option 1**
value: 199.99,
tax: 15.00,
shipping: 5.00,
currency: 'USD',
items: [
{
item_id: 'SKU_12345',
item_name: 'Wireless Headphones',
affiliation: 'Online Store',
coupon: 'HEADPHONES10',
currency: 'USD',
discount: 10.00,
index: 0,
item_brand: 'SoundMagic',
item_category: '', **//option 1**
item_category2: undefined , **//option 2**
price: 99.99,
quantity: 1
}]
}
});```