How to check source from where user is landing on my product, like instagram, linkedin, youtube etc.
Hi Abhijeet 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
To track where users are landing on your product from sources like Instagram, LinkedIn, YouTube, etc., Mixpanel offers several attribution tracking methods:
Web Attribution
Mixpanel's JavaScript library automatically tracks UTM parameters and referrer information: 1. UTM Parameters: Mixpanel tracks all UTM tags by default, including: - utm_source: identifies where traffic is coming from (e.g., Instagram, LinkedIn) - utm_medium: identifies the advertising medium - utm_campaign: identifies the specific campaign name - utm_content: identifies specific links within ads - utm_term: identifies keywords associated with campaigns
Traffic Attribution documentation provides details on how these parameters are tracked.2. Referrer Information: Mixpanel tracks Initial Referrer and Initial Referring Domain properties, which show where users first came from before landing on your site.
Implementation Options
For Web Applications:
The JavaScript SDK automatically captures this information. To optimize for attribution models, use this initialization option: LBKSmixpanel.init('YOUR_PROJECT_TOKEN', { stop_utm_persistence: true // disable utm persistence });LBKS
For Server-Side Implementation:
You'll need to manually extract UTM parameters and referrer information from requests. Here's an example in Python: ```from urllib.parse import urlparse
from mixpanel import Mixpanel
mp = mixpanel.init("YOUR_TOKEN")
def track_to_mp(request, event_name, properties): if "Referer" in request.headers: properties.update({ "referring_domain": urlparse(request.headers["Referer"]).hostname })
assumes query parameters are available as Flask request.args dict
utm_keys = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"] utm_values = {key: request.args[key] for key in utm_keys if request.args.get(key)} properties.update(utm_values)
properties["ip"] = request.remote_addr mp.track(request.user_id, event_name, properties)```
For Mobile Applications:
Mobile attribution is more complex: - For Android, you can use Google's Play Install Referrer Library - For iOS, you'll need a mobile attribution partner as the App Store strips referrer dataMobile Attribution documentation recommends using a partner service for reliable tracking, with several integration options available.
Analyzing Attribution Data
Once you've collected this data, you can use Mixpanel's Attribution feature to analyze which sources are driving conversions: - Choose different attribution models (first touch, last touch, linear, etc.) - Set lookback windows - Break down conversions by sourceThis helps you understand which marketing channels are most effective at bringing users to your product.
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.