Skip to main content
Upfluence sales tracking (AST) - Shopify
Updated over a week ago

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

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.upfluence.co/js/v1/init-b0464e28-945f-49b8-bda4-cda252af6d82.js')
    script.setAttribute('async','');
    document.head.appendChild(script);

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

    let items = []

    event.data.checkout.lineItems
    checkout.lineItems.forEach(function (lineItem ) {
    items.push({name: lineItem.title, amount: lineItem.finalLinePrice.amount, currency: lineItem.finalLinePrice.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?