Mixpanel Community Icon

Working with Marketing Campaigns and UTM Source Attribution

·
·

how to work with marketing campaings and sources attribution with UTMs,

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Hi Juan I., 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

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Working with Marketing Campaigns and UTM Attribution in Mixpanel

    Mixpanel provides robust capabilities for tracking marketing campaigns and attributing user actions to specific sources using UTM parameters. Here's how to work with them:

    Tracking UTM Parameters

    Mixpanel's JavaScript SDK automatically tracks UTM parameters present on the page: LBKS// Create an instance with recommended UTM tracking settings mixpanel.init('YOUR_PROJECT_TOKEN', { stop_utm_persistence: true // disable UTM persistence for better attribution models });LBKSThe SDK captures these UTM parameters by default: - utm_source, utm_medium, utm_campaign - utm_term, utm_content, utm_id - utm_source_platform, utm_campaign_id - utm_creative_format, utm_marketing_tacticPlus advertising click IDs like gclid, fbclid, etc. Track UTM Tags

    Server-Side UTM Tracking

    If you're implementing server-side tracking, you'll need to manually extract and send UTM parameters: ```from urllib.parse import urlparse from mixpanel import Mixpanelmp = 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 })

    Extract UTM parameters from request

    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)```Server-Side Attribution

    Using Attribution Models

    Mixpanel's Attribution feature (available on Enterprise or Growth plans) helps attribute conversion credit to touchpoints in a user journey: 1. Add your conversion metric 2. Go to the breakdown section and choose "Attributed by..." 3. Select the property to break down by (e.g., UTM medium) 4. By default, Mixpanel uses the Last Touch model with a 30-day lookback window 5. You can filter specific channels or touchpoints from the breakdown menuAttribution: Multi-touch segmentation

    Attribution Models Available

    Mixpanel supports various attribution models: - First Touch: Credits the first touchpoint - Last Touch: Credits the final touchpoint - Linear: Distributes credit equally across all touchpoints - U-shape: Weights first and last touchpoints more heavilyFor example, if a user first discovers your product via Facebook and later converts after seeing an Instagram ad, different models would attribute the conversion differently. Learn to Use Mixpanel: Multi-Touch Attribution

    Building Marketing Analytics Dashboards

    Create dashboards to visualize your marketing data: 1. Set up analytics funnels to track user conversion paths 2. Build marketing dashboards showing KPIs like CAC, ROAS, and attribution 3. Share these dashboards with your teamWhat is marketing analytics?For the best results with attribution analysis, ensure you're tracking UTM parameters as event properties on every user touchpoint, and consider using the recommended stop_utm_persistence: true setting for more accurate multi-touch attribution models.

    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.