Skip to content
  • There are no suggestions because the search field is empty.

Setting Up Convert.com Experiment Tracking in HubSpot

🔗 Connect Convert A/B Tests with HubSpot for Advanced Segmentation & Automation

🚀 THIS ARTICLE WILL HELP YOU:

🎯 Benefits of This Integration

  • Data-Driven Marketing: Segment contacts based on which experiments they've seen and which variations performed best

  • Personalized Follow-up: Create workflows that send different email content based on which experiment variation a contact was exposed to

  • Conversion Analysis: Identify which experiment variations lead to the highest conversion rates for different customer segments

  • Customer Journey Mapping: Understand how A/B tests influence the overall customer journey

  • ROI Measurement: Quantify the impact of your experimentation program on revenue metrics

  • Automated Targeting: Use successful experiment data to automatically move contacts into appropriate lists for future campaigns

  • Unified Data: Bring all your experimentation data into your central CRM for comprehensive reporting

  • Experimentation Feedback Loop: Use insights from HubSpot reports to inform future experiment designs

By tracking Convert.com experiments in HubSpot, you create a powerful feedback loop that allows you to personalize marketing efforts based on proven experiment results, ultimately leading to higher conversion rates and better customer experiences.

🔧 Step 1: Create a Custom Event in HubSpot

  1. Log in to your HubSpot account

  2. Navigate to the Custom Events section in the HubSpot app (you can search for "Custom Events" in the HubSpot search bar)

  3. Click Create Custom Event

  4. Select the Code Javascript option

  5. Name the event "Experiment Viewed"

  6. Select the Custom string property option

  7. Name the property "Experiment Viewed" again

  8. Click Done

  9. HubSpot will display code containing your unique event ID (e.g., pe20848441_experiment_viewed)

  10. Copy this ID — you'll need it for the integration code

🧩 Step 2: Implement the Tracking Code

Add the following code snippet to your Project > Configuration > Global Project JS.
Replace "pe20848441_experiment_viewed" with your HubSpot-provided event ID.

// Convert + HubSpot Integration for Experiment Tracking
var convertData = window.convert && window.convert.data ? window.convert.data : {};

// Loop through each experience
if (convertData.experiences) {
    for (var experienceId in convertData.experiences) {
        if (!convertData.experiences.hasOwnProperty(experienceId)) {
            continue;
        }

        var experience = convertData.experiences[experienceId];
        var variation = experience.variation;

        // Only track if we have valid variation data
        if (variation && variation.name) {
            var _hsq = window._hsq = window._hsq || [];
            _hsq.push([
                'trackCustomBehavioralEvent',
                {
                    name: "pe20848441_experiment_viewed", // REPLACE with your HubSpot event ID
                    properties: {
                        experience_id: experienceId,
                        variation_name: variation.name,
                        variation_id: variation.id,
                        is_first_time: experience.firstTime
                    },
                },
            ]);
        }
    }
}

🧪 Step 3: Test Your Integration

  • Use your browser's developer console to verify events are firing

  • Check a contact record in HubSpot to see if experiment events appear in their timeline

📋 Step 4: Filtering Contacts by Experiment Data

Once or while you run the experiment, create a list and related filters to see which contacts were part of the experiment or variation.

  1. Navigate to Contacts > Lists in HubSpot

  2. Click Create list and select “Contacts”

  3. Name your list (e.g., "Contacts who saw Variation A")

  4. Add filter

  5. Under Category, search for Custom Events and then select the “Experiment Viewed” event

  6. Choose how to filter:

    • experience_id: Filter for specific experiments

    • variation_name: Filter for specific variations

    • isfirsttime: Filter for first-time viewers

  7. Click Apply filter

  8. Add additional filters if needed

  9. Click Save to create your list

⚠️ Note:
If Data Anonymization is turned on in your Project > Configuration > More Settings, you must filter using experiment and variation IDs.
If it is off, you can filter using experiment and variation names.

If you have any issues or questions, please contact support.