Hey kapa.ai, does Mixpanel automatically capture UTM parameters (like utm_source, utm_medium, utm_campaign) or do I need to manually extract and pass them in events? is there another best practice?
Yes, Mixpanel can automatically capture UTM parameters (such as utm_source, utm_medium, utm_campaign, etc.) when you use its JavaScript SDK on web platforms. The SDK will automatically add any UTM parameters present in the page URL to events fired from that page load. These UTM parameters are also persisted across events as Super Properties by default, and you can control this behavior with the stop_utm_persistence option during SDK initialization. Additionally, the first-seen UTM parameters are stored as user profile properties (e.g., initial_utm_source) for identified users, which is useful for attribution analysis and understanding original acquisition channels Track UTM Tags.Example:Best Practice: If you are using Mixpanel’s JavaScript SDK, you do not need to manually extract and pass UTM parameters—they are handled automatically. However, if you are tracking events server-side, you must manually extract UTM parameters from the request and include them as event properties, since server-side environments do not have access to the browser’s URL context Web Attribution Server-Side Attribution.In summary: - Web (JavaScript SDK): UTM parameters are automatically captured. - Server-side: You must manually extract and send UTM parameters.This approach ensures your marketing attribution and campaign analytics are accurate and require minimal manual intervention when using the recommended SDKs.
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.
We're using the JavaScript SDK, but UTM parameters (utm_source, utm_medium, etc.), referrer, and device/browser info are not showing up in our events. Shouldn’t these be automatically added as super properties? Do we need to manually extract and pass them if we’re not seeing them in the event payloads? kapa.ai
Let me check the knowledge base for you again. One moment! 📚
If you are using the Mixpanel JavaScript SDK, UTM parameters (like utm_source, utm_medium, utm_campaign), referrer, and device/browser information should be automatically captured and included as event properties by default. These are typically added as super properties and sent with all events, as long as the SDK is properly initialized and the page URL contains these parameters or the browser provides the necessary context.**However, if you are not seeing these properties in your event payloads, here are some things to check:**1. SDK Initialization: Make sure you are initializing the SDK correctly and not disabling default property collection via configuration options like property_blacklist. For example, if you use the property_blacklist option and include properties like $referrer, they will not be sent:
property_blacklist: ['$referrer', 'custom_property']
});
```LBKS This would prevent $referrer from being included in your events [Protecting User Data](https://docs.mixpanel.com/docs/privacy/protecting-user-data#blacklisting-default-properties).LBKS2. **UTM Parameter Persistence:**
By default, UTM parameters are persisted as super properties. If you have set stop_utm_persistence: true, UTM parameters will not persist across events, but they should still be captured on the initial event if present in the URL [Track UTM Tags](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#track-utm-tags).LBKS3. **Page Context:**
UTM parameters are only captured if they are present in the URL at the time the event is fired. If users land on your site without UTM parameters, or if events are fired on subsequent pages without UTM parameters and persistence is disabled, these properties will not be present [Web Attribution](https://docs.mixpanel.com/docs/tracking-best-practices/traffic-attribution#web-attribution).LBKS4. **Referrer and Device/Browser Info:**
These are also automatically captured by the JavaScript SDK as default properties, unless blacklisted or if the browser does not provide them (e.g., due to privacy settings or direct navigation) [Default Properties](https://docs.mixpanel.com/docs/data-structure/property-reference/default-properties#event-properties-1).LBKS**If after checking the above you are still not seeing these properties:**
- Double-check your SDK version and initialization code.
- Ensure you are not using property_blacklist or other config options that would suppress these properties.
- If you are using a custom event tracking implementation or firing events before the SDK is fully initialized, these properties may not be available.LBKS**You do NOT need to manually extract and pass these properties when using the JavaScript SDK under normal circumstances.**
Manual extraction is only necessary for server-side tracking or if you have intentionally disabled automatic property collection.If the issue persists after these checks, it may be worth reviewing your implementation or reaching out to Mixpanel support for further troubleshooting.References: - Track UTM Tags - Protecting User Data - Default Properties - Web Attribution
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.
Let me check the knowledge base for you again. One moment! 📚
Here’s what the knowledge sources say about each property: - $referring_domain: Yes, this is automatically tracked by the JavaScript SDK as a default event property, if available from the browser context. It represents the referring domain, including your own domain, and may be omitted if the user lands directly or the referring website uses rel="noreferrer" Default Properties: Event Properties.- $search_engine: Yes, this is also automatically tracked by the JavaScript SDK as a default event property. It captures the search engine used when a customer arrives at your domain Default Properties: Event Properties.- $first_name and $last_name: These are not automatically tracked. They are not listed among the default or reserved properties that Mixpanel collects automatically. You would need to set these as user profile properties yourself if you want to capture them.- $city, $region, mp_country_code: Yes, these are automatically tracked as default event properties. They are derived from the IP address or latitude/longitude of the event sender and are included in events by default unless geolocation is disabled Default Properties Geolocation.**Summary Table:**| Property | Automatically Tracked? | |--------------------|-----------------------| | $referring_domain | Yes (if available) | | $search_engine | Yes (if available) | | $first_name | No | | $last_name | No | | $city | Yes | | $region | Yes | | mp_country_code | Yes |If you need to track $first_name or $last_name, you must set them manually as user profile properties. The others are handled automatically by Mixpanel’s JavaScript SDK, provided the necessary context is available and default property collection is not disabled.
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.
Let me check the knowledge base for you again. One moment! 📚
If your newly implemented events are not firing in Mixpanel, here are the most common causes and troubleshooting steps based on the knowledge sources: 1. Check SDK Initialization and Event Triggering
- Ensure the Mixpanel SDK is correctly initialized with the right project token before any events are fired.
- Confirm that your event tracking code (e.g., mixpanel.track('Event Name')
) is being executed as expected.2. Debug Mode and Browser Console
- Enable debug mode in the SDK to log Mixpanel calls in your browser console. This helps verify if events are being sent from your app.
- Open your browser’s developer console, go to the Network > Fetch/XHR tab, and look for requests to the Mixpanel API. Check for errors or failed requests. Make sure the “token” in the payload matches your project token and the correct API host is used for your data residency (US, EU, or India).3. Ad Blockers and Do Not Track (DNT)
- Ad blockers or browser privacy settings (like DNT) can prevent events from being sent. Disable these when testing to ensure they are not interfering Why aren't my events showing up?.4. Check for Hidden or Inactive Events
- Events that haven’t fired in the last 30 days may be hidden from dropdowns in the UI, but should still appear in the raw data. You can search for the event by name in the Events report Check for Hidden Events and Properties.5. Correct API Host for Data Residency
- If your project uses EU or India data residency, ensure the SDK is configured to send data to the correct API host ([api-eu.mixpanel.com](http://api-eu.mixpanel.com)
or [api-in.mixpanel.com](http://api-in.mixpanel.com)
). Otherwise, events will be rejected Ensure you are using the API host that matches your project’s data residency.6. Validate in the Events Report
- Use the Events report to see if your events are arriving. You can filter or search by properties like distinct_id
to find your test events Debugging with Events.If you have checked all of the above and events are still not appearing, review your implementation for typos, incorrect event names (Mixpanel is case sensitive), or logic errors that might prevent the event from firing.
If you need more detailed troubleshooting, refer to the Mixpanel debugging guide.
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.
the event is firing, I can see on the inspect: Trial Form: Viewed Personal Info Step {"action":"Trial Form: Viewed Personal Info Step","pageUrl":"https://test.webflow.io/trial","domain":"shortpoint.com","eventOrigin":"client-side","packageType":"spfx","email":"luisa@test.com","phone":"+351912345","displayName":"luisa Silva","environment":"Microsoft 365","tenant_url":"","is_new_user":false,"country":"spain","appCodeName":"Mozilla","appName":"Netscape","appVersion":"5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36","languages":["en-GB","en-US","en"],"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36","vendor":"Google Inc.","utm_source":"","utm_medium":"","utm_campaign":"","utm_term":"","utm_link":"https://test.webflow.io/trial"} but not on mixpanel kapa.ai
Let me check the knowledge base for you again. One moment! 📚
If you can see the event firing in your browser’s developer tools (with the correct payload), but it is not appearing in Mixpanel, here are the most likely causes and troubleshooting steps based on the official documentation: 1. Check API Host and Project Token
- Make sure your Mixpanel SDK is configured to use the correct API host for your project’s data residency (US, EU, or India). If your project is set to EU or India data residency but the SDK is sending events to the default US endpoint, events will be rejected and will not appear in your project see details.
- Confirm that the “token” in your event payload matches the token in your Mixpanel Project Settings.2. Ad Blockers and Privacy Settings
- Ad blockers or browser privacy settings (like Do Not Track) can block requests to Mixpanel, causing events to not reach the server even if they appear in your console. Try disabling ad blockers and DNT settings during testing see FAQ.3. Network Errors or CORS Issues
- Use your browser’s Network tab to check if the request to the Mixpanel API endpoint is successful (HTTP 200). If you see CORS errors or HTTP errors (like 415), your proxy or server may not be forwarding headers correctly, or your Content Security Policy may be blocking the request see CORS troubleshooting.4. Hidden or Inactive Events
- If the event is new and hasn’t fired in the last 30 days, it may be hidden from dropdowns in the Mixpanel UI, but should still be visible in the raw Events feed. Try searching for the event by its exact name (case sensitive) in the Events report see hidden events.5. Debugging with Events Report
- Go to the Events report and search for your event using properties like distinct_id
or other unique values from your payload to confirm if it’s arriving at all see debugging steps.6. Check for Property Blacklisting
- If you are using the property_blacklist
option in your SDK initialization, make sure you are not unintentionally excluding properties or events see property blacklisting.
If you have verified all of the above and still do not see your event in Mixpanel, it is possible there is a configuration or network issue preventing the event from being ingested. Double-check your SDK initialization, network requests, and project settings. If the problem persists, you may need to contact Mixpanel support for further assistance.References integrated above from official Mixpanel documentation.
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.