How do I strip the ad related data from URL's from the url in a page view event so that I only have the page views when using Breakdown in an insights report?
Hi Bradley A., 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
To strip ad-related data (such as UTM parameters) from URLs in your page view events—so that your Insights report breakdown only considers the core page path or URL without ad tracking parameters—you should use Mixpanel’s custom properties and functions.Here’s how you can approach this: 1. Track the Full URL as a Property
By default, Mixpanel’s page view event ($mp_web_page_view) includes properties like current_url_path (just the path), current_url_search (query string, including UTM params), and current_url (full URL). If you want to break down by the page path only, use current_url_path as your breakdown property. This property does not include query parameters, so UTM and other ad-related data will be excluded from your breakdown automatically Track Page Views.2. If You Need to Parse or Clean a Custom URL Property
If you are tracking a custom URL property that includes query parameters, you can use Mixpanel’s custom property functions to extract just the path or domain. For example, you can use the parse_url function in a custom property:
```LBKSLBKS This will extract only the path component of the URL, stripping out any query parameters (including UTM/ad data)Â [Custom Properties: Functions](https://docs.mixpanel.com/docs/features/custom-properties#functions).LBKS3. **Breakdown in Insights Report**
When building your Insights report, select the property that contains only the path (e.g., `current_url_path` or your custom property using `parse_url`). This ensures your breakdown is by the page itself, not by ad-related query parameters.LBKS**Summary:**
- Use `current_url_path` for breakdowns to ignore query parameters.
- Or, use a custom property with `parse_url(your_url_property, "path")` to extract the path from a full URL.LBKSThis approach will ensure your page view analysis is not fragmented by ad-related data in the URL.LBKSReferences:
- [Track Page Views](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#track-page-views)
- [Custom Properties: Functions](https://docs.mixpanel.com/docs/features/custom-properties#functions)
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.
