hi looking to create an if formula for a custom event property to filter out page loads where there is no UTM's found. Having issues with what to put for the null values. Have tried "(not set)", "not set", "empty string" to no avail. Formula right now for example is
if( page name = X
and not ( UTM Source = UNDEFINED) and ( UTM Medium = UNDEFINED) and ( UTM etc = UNDEFINED) ), true, false )
Hi Rich S., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
You’re on the right track—what’s tripping you up is the value you’re checking for. In Mixpanel, when a property isn’t present on an event, it shows as “(not set)” in the UI, but the underlying concept is that the property is undefined or null. In Custom Properties, you should check for existence rather than compare to the text “(not set)”.Two reliable approaches: 1) Use defined() to ensure UTMs exist
- defined(X) returns true only if the property is actually present on the event.
- Example (UTM Source and UTM Medium must both be present): LBKSif( A == "X" and defined(utm_source) and defined(utm_medium), true, false )LBKSReplace A with your page name property. You can add more UTMs with and defined(utm_campaign), etc. [Functions; Falsy values]2) Exclude events where the UTM is not set by checking “is set”
If you’re filtering in a report rather than inside a formula, you can use the report filter “Property is set” to exclude undefined/null, since “(not set)” in the UI corresponds to undefined/null underneath. [Falsy values]Why not compare to "(not set)" or empty string?
- “(not set)” is a UI label for undefined/null; it isn’t an actual stored value on the event. Comparing strings like "(not set)" or "not set" won’t match. [Falsy values]
- Empty string "" is different; it only appears if you literally sent "" as the value. [Falsy values]Putting it all together for your case
If you want “true” only when:
- page_name equals X, and
- at least one UTM is present (i.e., you want to filter out page loads with no UTMs at all): LBKSif( page_name == "X" and ( defined(utm_source) or defined(utm_medium) or defined(utm_campaign) or defined(utm_term) or defined(utm_content) ), true, false )LBKSIf you instead want “true” only when all required UTMs are present, use and between defined() checks. [Functions; Track UTM tags]Tip: UTMs are only auto-captured on web via the JS SDK; server-side or other sources won’t have them unless you send them, so those events will appear as undefined. [Web attribution; JavaScript UTM]
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
following up for this, with this query what you shared a I also include and not partner name = XX and time is between 8/4 and 8/5. Why am I only seeing exclusion of utms from july to August and then start seeing pageloads with those who have not set or emplty string for utms
