You thought you sent clean custom parameters to GA4. You named one plan_price and dutifully passed a number. Then you opened BigQuery - and surprise! Sometimes it’s empty, sometimes it says "free," sometimes it’s NULL, and occasionally someone dropped in “N/A” just because they could.
GA4 is like communicating with deep space - you never know what’s coming back. And unlike the GA4 interface, BigQuery shows you the raw chaos exactly as it is.
So, how do you get a clean column with numeric price values?
Use the dream duo: SAFE_CAST + IFNULL
• SAFE_CAST politely tries to convert a string to the desired type. If it fails, it doesn’t scream or break—just returns NULL.
• IFNULL replaces that NULL with something useful. Like 0. Or “Unknown”. Or your mood during debugging.
What’s happening here on the screenshot?
• You unnest the event_params array
• Filter for the parameter called plan_price
• Try to convert its value to a number
• If it fails (e.g. the value is "free", "none", or foggy nonsense), you set it to 0
Takeaway:
• GA4 is all about flexibility.
• BigQuery is all about the unfiltered truth.
And SAFE_CAST + IFNULL are about your sanity as an analyst.
If you don’t want one rogue “unknown” to wreck your whole aggregation, clean your fields upfront. SQL — like life — is smoother with a few safety checks.
And remember: custom parameters are like uninvited guests. They show up unannounced and rarely behave.
Want to get all my top Linkedin content? I regularly upload it to one Notion doc.
Go here to download it for FREE.


