On this page
What this issue is
Every GA4 event can carry parameters, which are extra details such as form_id, method, value or item_name. This issue happens when the event is sent, but one parameter has no usable value. It then arrives as the text undefined, the text null, an empty string, or it is dropped and the report shows (not set).
| What you see | Usual cause |
|---|---|
| Literal text undefined | A JavaScript variable or object property did not exist when the code ran |
| Literal text null | A data layer value was explicitly set to null, or a lookup returned null |
| (not set) in a report | Parameter missing, empty, or not registered as a custom dimension |
| Value is blank in GTM Preview | Variable name is misspelled or the data layer push happens after the tag fires |
Why it costs you leads or sales
- Visitor submits formReal action happens
- Tag reads variableVariable returns undefined
- GA4 receives eventParameter empty or 'undefined'
- Report shows (not set)No form, product or source detail
The event fires, but the parameter is empty, so reporting loses the detail.
Example: share of 100 lead events where the form_id parameter holds a real value, before and after a fix.
How to check if your site has it
Open GA4 DebugView
In GA4 go to Admin > DebugView, then trigger the event on your site with GTM Preview mode or the GA debug extension active. Click the event and read each parameter value.
Look for the words undefined or null
Any parameter showing the literal text undefined or null, or missing from the list, is affected.
Check GTM PreviewGoogle Tag Manager
In Tag Assistant, click the event, open the GA4 tag and view its Values. Then open the Variables tab at that moment to see which variable is Undefined.
Check the network request
In browser DevTools open Network, filter by collect, and read the request payload. Parameters appear as ep.name for text and epn.name for numbers.
Check reports
In Reports or Explore, add the registered custom dimension and look for (not set) rows.
How to fix it
Match the variable name exactly
Open the Data Layer Variable and compare its name with the key in the push. Keys are case sensitive, so formId and form_id are different.
Fix the timing
Make sure the dataLayer.push with the value runs before the event that triggers the tag. Use a Custom Event trigger on the push, not a click trigger that fires earlier.
Set a default value
In the variable settings, tick Set Default Value and enter a clear fallback such as unknown, so gaps are visible rather than blank.
Remove empty parameters
If a value does not apply to some pages, use a trigger condition so the tag only fires where the value exists.
Read values safely
Check that the value exists before sending, using optional chaining and a fallback.
Send only defined parameters
Build the parameter object and skip keys that are undefined or null.
Check the plugin mapping
In your form or analytics plugin, open the GA4 event settings and confirm each parameter is mapped to a field that exists on that form.
Update after form edits
If a field was renamed or deleted, remap it. Mappings to removed fields send empty values.
Check the Liquid or pixel source
If you send events from theme code or a custom pixel, confirm the object you read (for example product or checkout) exists on that page type.
Use the right data source
On checkout pages, read values from the customer events data in a custom pixel rather than theme variables, which are not available there.
Check CMS bindings
If a parameter comes from a custom attribute bound to a CMS field, confirm the field is filled in for every item.
Check the script placement
Place your event code in the page or project custom code so it runs after the elements it reads exist.
function sendLead(params) {
var clean = {};
Object.keys(params).forEach(function (key) {
var v = params[key];
if (v !== undefined && v !== null && v !== '') {
clean[key] = v;
}
});
gtag('event', 'generate_lead', clean);
}
var form = document.querySelector('#contact-form');
sendLead({
form_id: form ? form.id : 'unknown',
method: 'contact_form'
});How to confirm it's fixed
- DebugView shows a real value for every parameter on the event
- No parameter contains the text undefined or null
- GTM Preview shows each variable with a value when the tag fires
- The Network request to collect includes the expected ep. or epn. keys
- After 24 to 48 hours, reports show far fewer (not set) rows for new data
- Test on more than one page or form, not just one
How to prevent it happening again
- Keep a written list of each event and its parameters, with where each value comes from
- Set default values on GTM variables
- Re-test events after any form, theme, plugin or checkout change
- Keep data layer key names consistent across developers and tools
- Review GA4 reports for (not set) rows regularly
- Run an automated check on your key journeys
How FunnelGuard handles this
Questions people ask
Why does my GA4 event parameter show undefined?
The tag or code read a variable that did not exist when the event fired. Common causes are a misspelled variable name, a data layer push that runs after the tag, or a property that is missing on that page. Check it in GTM Preview or GA4 DebugView.
Why is my GA4 custom dimension showing (not set)?
Either the event did not send the parameter with a value, or the parameter is not registered as a custom dimension. Check DebugView for the value first. If it is there, register it in Admin > Custom definitions; it only applies to data collected afterwards.
How do I fix undefined variables in Google Tag Manager?
Open GTM Preview, click the event and check the Variables tab to see which one is Undefined. Fix the name or timing, and set a default value in the variable. Then re-test in DebugView.
What is the difference between undefined, null and (not set) in GA4?
Undefined and null are values your code or tag sends as text when data is missing. (not set) is what GA4 reports show when a dimension has no value for an event. They all point to missing data, but the fix location differs.
Does an undefined parameter stop GA4 from counting the event?
No. The event is usually still counted. Only the detail attached to it is lost, which is why the problem often goes unnoticed in conversion totals.
Can I fix (not set) values in old GA4 data?
No. GA4 does not let you edit past event data, so you can only fix new data going forward. Fix the source, then compare reports from the fix date.
How can I check GA4 parameters without opening DevTools?
Use GA4 DebugView with GTM Preview or the GA debug extension. It lists each event and its parameter values in real time. An automated journey monitor can also check them on a schedule.
Related issues
- TRK-049Required event parameter missing (form_id, method)Fix guide
- TRK-051Parameter values contain template placeholders ({{Click Text}})Fix guide
- TRK-053Custom dimensions sent but not registered in GA4Fix guide
- TRK-055Event value sent as string with currency symbol ('$99')Fix guide
- TRK-056value sent without currency parameterFix guide
- TRK-043generate_lead not sent on form submitFix guide