Skip to main content

Installing the SocialLadder Shopify Integration for Link-Based Tracking

A Complete Guide for Setting Up SocialLadder’s Link-Based Tracking with Shopify

Marshall avatar
Written by Marshall
Updated over 5 months ago

Important Notice for Existing Users:

If you have previously installed our Shopify integration using the “Additional Scripts” method, please refer to our upgrade guide to update your integration.

This article is intended for new users who are installing the integration for the first time.

Introduction

This guide walks new customers through the process of installing the SocialLadder integration with Shopify, enabling link-based tracking for branded ambassador referral links. This step-by-step tutorial ensures that your Shopify store is fully integrated with SocialLadder using the new pixel-based method.

Steps for Installing or Updating the SocialLadder Shopify Integration

Step 1: Log Into Your Shopify Admin

  1. Visit [your-store-url].myshopify.com/admin and log into your Shopify store.

Step 2: Access the Theme Editor

  1. On the left sidebar, go to Online Store > Themes.

  2. Find your active theme and click the Customize button.

Step 3: navigate to the Product Page

  1. At the top of the screen, you'll see a dropdown menu with the option to select pages.

  2. Select Product > Default Product.

Step 4: Customize Product Information

  1. On the left-hand menu, select Product Information.

Step 5: Edit Theme Code

  1. At the top-left corner, click the ellipsis (...) and select Edit Code.

Step 6: Add JavaScript for SocialLadder

  1. Under Layout, select theme.liquid.

  2. Scroll to the end of the file and paste the following code just above the </body> tag:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    <script src="https://socialladder.rkiapps.com/Shopify/socialladder-shopify.js" type="text/javascript"></script>

  3. Ensure that the scripts are pasted in this exact order.

  4. Click Save to apply the changes.

Step 7: Return to the Shopify Admin Dashboad

  1. After saving the code, exit the code editor by clicking Exit.

  2. Navigate back to your Home Page.

New Steps for Shopify's Link-Based Tracking

Step 8: Setting Up the Custom Pixel

  1. In your Shopify admin, navigate to Settings > Customer Events.

  2. Click on Add custom pixel.

  3. Name the pixel (e.g., "SocialLadder-Pixel").

  4. In the Permissions section, select Not required.

  5. In the Date sale section, select Data collected does not qualify as data sale.

  6. Click Save to confirm the setup.

Step 9: Implementing the Updated JavaScript Code

  1. Replace the existing script in the Code section with the following:

    analytics.subscribe("checkout_completed", event => {
    var slScript = document.createElement("script");
    var jqScript = document.createElement("script");
    var img = document.createElement("img");

    // Prepare order data
    var orderId = event.data.checkout.order.id;
    var price = event.data.checkout.totalPrice.amount;
    var quantity = 0;
    var promoCode = "";
    var email = event.data.checkout.email;
    var currency = event.data.checkout.totalPrice.currencyCode;

    // Set quantity
    event.data.checkout.lineItems.forEach((lineItem) => {
    quantity += lineItem.quantity;
    })

    // Set promo code
    var discountCodeApplication = event.data.checkout.discountApplications.filter((app) => app.type == "DISCOUNT_CODE");

    if (discountCodeApplication.length > 0) {
    promoCode = discountCodeApplication[0].title;
    }

    // Send event data
    slScript.onload = function() {
    if (typeof window.loadSLImage === "function") {
    img.onload = loadSLImage;
    }

    if (typeof window.SLCheckout === "function") {
    SLCheckout(orderId, price, quantity, promoCode, email);
    }
    }

    // Configure placeholder image
    img.width = "1";
    img.height = "1";
    img.src = "";
    img.id = "slPixel";

    // Append elements
    jqScript.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";
    jqScript.type = "text/javascript";

    slScript.src = "https://socialladder.rkiapps.com/Shopify/socialladder-shopify.js";
    slScript.type = "text/javascript"

    document.body.appendChild(img);
    document.head.appendChild(jqScript);
    document.head.appendChild(slScript);
    });

  2. Click Save to apply your changes.

  3. Click Connect to activate the Pixel.

Optional: Adding Currency Tracking

If your Shopify store operates in multiple currencies, you can extend tracking functionality.

  1. Add the currency variable to the SLCheckout function. Example:

    SLCheckout(orderId, price, quantity, promoCode, email, currency);
  2. Once you’ve made your changes, click the Save button at the top of the screen, followed by Connect to enable the custom pixel. The pixel is now active and tracking.

Important:

  • Ensure that the currency conversion feature is enabled within the SocialLadder system to accurately track and reflect multi-currency sales data.

  • Please inform your Customer Success Manager (CSM) if you are using multiple currencies, so they can assist in ensuring that everything is properly configured on both Shopify and SocialLadder Platform.

Troubleshooting

For any issues with the setup, please contact your dedicated Customer Success Manager (CSM) or use the chat feature in the SocialLadder Admin Web Portal.

Conclusion

By following these steps, you will have successfully updated or installed the new SocialLadder integration for Shopify. This ensures continued tracking functionality after Shopify deprecates the “Additional Scripts” feature.

Did this answer your question?