Skip to main content
All CollectionsProduct RecommendationsA/B Testing & Analytics
How to push LimeSpot A/B test data to Google Analytics
How to push LimeSpot A/B test data to Google Analytics

Learn how to push the LimeSpot A/B test experience details to Google Analytics.

Updated over 5 months ago

After you have set up an A/B test experience with LimeSpot, you can attach LimeSpot Experience details to your Google Analytics tracking as a Custom Dimension, to get more detailed reports and funnel optimization.

Here's how you can achieve this:

  1. Login to your Google Analytics dashboard, click on ADMIN from the navigation bar, and select the property that is associated with your online store. Click on Custom Definitions section, and select Custom Dimensions.

  2. Create a new custom dimension and call it something meaningful like LimeSpot Experience.

  3. When you create a custom dimension in Google Analytics, a numeric value will be assigned to it as the index of that dimension. You can update this index by editing the dimension in the same place. Please take a note of the index associated with the new dimension for the next steps.

  4. Add the appropriate script below to your website HTML <head> section (in Shopify, this is within your theme.liquid):

    If you are using "Universal Analytics properties":

    LimeSpot.ListenOnce(document, "lsReady", function () { 
    ga('set', 'dimensionZ', LimeSpot.Context.ExperiencTitle);
    });

    If using Google Tag (gtag), and gtag is already initialized on your website:

    LimeSpot.ListenOnce(document, "lsReady", function () { 
    gtag('config', 'UA-XXXXXXX-Y', {
    'custom_map': {'dimensionZ': 'LimeSpot Experience'}
    });

    gtag('event', 'user_authenticate', { 'LimeSpot Experience': LimeSpot.Context.ExperiencTitle });
    });


    If using Google Tag (gtag), and gtag is NOT initialized on your website elsewhere:

    LimeSpot.ListenOnce(document, "lsReady", function () {   
    LimeSpot.Storefront.LoadScript(
    'https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-Y',
    'pixel',
    function() {
    window.dataLayer = window.dataLayer || [];
    function gtag(){ dataLayer.push(arguments); }
    gtag('js', new Date());
    gtag('config', 'UA-XXXXXXX-Y', {
    'custom_map': {'dimensionZ': 'LimeSpot Experience'}
    });
    gtag('event', 'user_authenticate', { 'LimeSpot Experience': LimeSpot.Context.ExperiencTitle });
    }
    );
    });


    The scripts should NOT be added in this section:

Notes:

  • UA-XXXXXXX-Y should be replaced with your Google Analytics Property ID.

  • Z in dimensionZ above needs to be replaced with the dimension index described in step 3 above.

  • limespot_experience should be replaced with the name you give the dimension on Google Analytics as described in step 2.

  • If you need to learn more about custom dimensions and how to use them in Google Analytics, here is a link to Google's documentation around this.

🤔 Questions? Need help? Contact us via the in-app chat or email.

Did this answer your question?