How to Integrate with Segment

Segment is a powerful CDP platform to collect, clean, and control customer data. With the Digioh + Segment integration you can show powerful behavioral pop-ups to capture emails based on our Segment Data. You can also create web forms, landing pages, and subscriber paywalls with Digioh.

Here is how you can pass all your data to Segment when a user submits a form.

Login to your Digioh account, click on “Custom JS Parent”, in the After Box Submit section enter this:

if (typeof window.analytics !== 'undefined') {
    var lightbox_short_id = lightbox_id;
    if (DIGIOH_LIGHTBOX_IDS && DIGIOH_LIGHTBOX_IDS.hasOwnProperty(lightbox_id)) {
        lightbox_short_id = DIGIOH_LIGHTBOX_IDS[lightbox_id];
    }

    var lightbox_name = '';
    if (DIGIOH_LIGHTBOX_NAMES.hasOwnProperty(lightbox_id)) {
        lightbox_name = DIGIOH_LIGHTBOX_NAMES[lightbox_id];
    }

    var obj = {};
    obj.digioh_lightbox_id = lightbox_short_id;
    obj.digioh_lightbox_name = lightbox_name;

    if (typeof DIGIOH_LIGHTBOX_ANALYTICS !== 'undefined' && DIGIOH_LIGHTBOX_ANALYTICS.hasOwnProperty('form_submit_data')) {
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('email') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.email) obj.email = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.email;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('first_name') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.first_name) obj.first_name = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.first_name;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('last_name') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.last_name) obj.last_name = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.last_name;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('phone') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.phone) obj.phone = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.phone;

        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_1') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_1) obj.digioh_custom_1 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_1;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_2') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_2) obj.digioh_custom_2 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_2;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_3') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_3) obj.digioh_custom_3 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_3;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_4') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_4) obj.digioh_custom_4 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_4;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_5') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_5) obj.digioh_custom_5 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_5;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_6') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_6) obj.digioh_custom_6 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_6;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_7') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_7) obj.digioh_custom_7 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_7;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_8') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_8) obj.digioh_custom_8 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_8;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_9') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_9) obj.digioh_custom_9 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_9;
        if (DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.hasOwnProperty('custom_10') && DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_10) obj.digioh_custom_10 = DIGIOH_LIGHTBOX_ANALYTICS.form_submit_data.custom_10;
    }

    if (typeof DIGIOH_LIGHTBOX_ANALYTICS !== 'undefined' && DIGIOH_LIGHTBOX_ANALYTICS.hasOwnProperty('VARS')) {
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('city') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.city) obj.digioh_city = DIGIOH_LIGHTBOX_ANALYTICS.VARS.city;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('state') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.state) obj.digioh_state = DIGIOH_LIGHTBOX_ANALYTICS.VARS.state;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('country') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.country) obj.digioh_country = DIGIOH_LIGHTBOX_ANALYTICS.VARS.country;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('ip_address') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.ip_address) obj.digioh_ip_address = DIGIOH_LIGHTBOX_ANALYTICS.VARS.ip_address;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('web_source') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.web_source) obj.digioh_web_source = DIGIOH_LIGHTBOX_ANALYTICS.VARS.web_source;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('page_visits')) obj.digioh_page_views = DIGIOH_LIGHTBOX_ANALYTICS.VARS.page_visits;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('past_visits')) obj.digioh_past_visits = DIGIOH_LIGHTBOX_ANALYTICS.VARS.past_visits;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('device') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.device) obj.digioh_device = DIGIOH_LIGHTBOX_ANALYTICS.VARS.device;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('browser_type') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.browser_type) obj.digioh_browser = DIGIOH_LIGHTBOX_ANALYTICS.VARS.browser_type;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('operating_system') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.operating_system) obj.digioh_operating_system = DIGIOH_LIGHTBOX_ANALYTICS.VARS.operating_system;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('landing_page') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.landing_page) obj.digioh_landing_page_url = DIGIOH_LIGHTBOX_ANALYTICS.VARS.landing_page;
        if (DIGIOH_LIGHTBOX_ANALYTICS.VARS.hasOwnProperty('current_page_url') && DIGIOH_LIGHTBOX_ANALYTICS.VARS.current_page_url) obj.digioh_submit_page_url = DIGIOH_LIGHTBOX_ANALYTICS.VARS.current_page_url;
    }

    window.analytics.track('Digioh Submission', obj);
    window.analytics.identify(obj.email, obj);

    DIGIOH_CUSTOM_JS.log('Custom JS After Submit - sent Segment event');
}

This will pass all your form fields and analytics data anytime some submits the form. You can also pass when a box is displayed and when a box is closed.

We also have the ability to target boxes based on your Segment Persona data, please contact us to help you set that up.