Skip to main content
Upfluence sales tracking (AST) - Shopify
Updated this week

In the general guide, we explained how to configure Agnostic sales tracking system on all CMS on the market. However, each CMS has its own specificities and this guide simplifies the configuration.

If you’re using Shopify and want to install our Agnostic sales tracking system on your store, this guide walks you through the process.


Upfluence sales tracking - Shopify

Before you start:

We have tried to make it easier for you by replacing the necessary values in the script and assigning the different information correctly.

Step 1: Generate your personal script link

  1. Go to your Upfluence dashboard and navigate to the integration settings.

  2. Click the Generate script button. Give your tracking script a name to identify your site for generating affiliate links in the future.

  3. Set E-commerce platform as "Others"

  4. Press Generate script to create your custom tracking script.

Once generated, Upfluence will provide two scripts. Shopify users only need to use the URL from Script 1.

Note: Copy the link in Script 1 and save it temporarily in a notepad—you’ll need it for the next step.

Step 2: Install the script on your Shopify store

  1. To enable you to install the scripts, go to the script installation section in your Shopify administrator interface. This section is located in Settings > Customer events

  2. Click on "Add custom pixel" and start setting up your AST script.

  3. Set up Customer privacy, for best tracking experience, select:

    • Permission: Not required

    • Data sale: Data collected does not qualify as data sale

  4. Copy the code snippet provided and paste it into the code section to replace the default template on Shopify.

    const script = document.createElement('script');
    script.setAttribute('src', 'https://tracking-staging.upfluence.co/js/v1/init-1e1af39f-e593-49ae-b809-d7e0bd9cd2e0.js')
    script.setAttribute('async','');
    document.head.appendChild(script);

    analytics.subscribe('checkout_completed', (event) => {
    const checkout = event?.data.checkout

    let items = []

    checkout.lineItems.forEach(function (lineItem ) {
    if (Object.hasOwn(lineItem, 'finalLinePrice')) {
    items.push({name: lineItem.title, amount: lineItem.finalLinePrice.amount, currency: lineItem.finalLinePrice.currencyCode})
    return
    }

    console.error(
    "Upfluence could not find item finalLinePrice, " +
    "update to checkout extensibility ",
    "https://help.shopify.com/en/manual/checkout-settings/customize-checkout-configurations/checkout-extensibility"
    )
    items.push(
    {
    name: lineItem.title,
    amount: lineItem.variant.price.amount.amount - lineItem.discountAllocations.amount.amount,
    currency: lineItem.variant.price.currencyCode,
    },
    )
    })

    const customer = event?.data.checkout.order?.customer
    window._upf.push([
    'order',
    {
    order_id: checkout.order?.id, // required
    order_name: '#'+checkout.order.id, // required
    amount: checkout.subtotalPrice.amount, // required
    currency: checkout.subtotalPrice.currencyCode, // required,
    items: items,
    customer: {
    customer_id: customer.id,
    first_name: customer.firstName,
    last_name: customer.lastName,
    email: customer.email,
    }
    }
    ]);
    });

  5. Replace the Script URL:

    1. Use the URL from Script 1 generated earlier in Upfluence.

    2. Paste this URL into the appropriate line of the script to replace the default link.

    3. Click on Save

  6. Go back to the top of the page and click on Connect to finish your set up.

Did this answer your question?