Skip to main content

How to Install the Aspire Affiliates App

Install the Aspire Affiliates App on your Shopify store to enable SecureCodes, Offer Landing Pages, and Link Tracking

Written by Janine Borrega

Overview

Aspire connects to Shopify using two separate apps, each with a different purpose. Most merchants will install both apps.

1. Aspire App (Core Integration)

The Aspire App connects your Shopify store to Aspire and syncs your store data, including:

  • Customers

  • Products

  • Collections

  • Orders

This integration powers product catalogs, promo code creation, product cost calculations, and product gifting and fulfillment.

Install this app directly from your Aspire account by navigating to Integrations → Shopify.

2. Aspire Affiliates App (Link Tracking & Affiliate Features)

Install the Aspire Affiliates App from the Shopify App Store.

This app enables Aspire's affiliate functionality, including:

  • SecureCodes – Automatically generates unique, single-use promo codes when customers click a creator's affiliate link.

  • Offer Landing Pages – Creates personalized, shoppable storefronts for each creator.

  • Link Tracking – Tracks affiliate clicks and conversions using Shopify App Pixels.


Getting Started

Step 1: Verify Your Shopify Permissions

Before connecting your store, confirm that your Shopify account has the required permissions by following these steps.

In Shopify:

  1. Go to Settings → Users and Permissions.

  2. Select your user account.

  3. Verify you have the following permissions:

    Store permissions

    • Read and write access to:

      • Orders

      • Products

      • Customers

    App permissions

    • Manage and install apps and sales channels

If you don't have these permissions, contact your Shopify store admin before continuing. Learn more about Shopify permissions here.


Step 2: Connect Your Shopify Store

In Aspire:

  1. Go to Integrations.

  2. Select Shopify.

  3. Enter your store URL (for example, your-store.myshopify.com).

  4. Click Connect my store.

  5. Log in to Shopify when prompted.

  6. Click Install App.

After connecting:

Note: The initial customer data sync can take up to 24 hours to complete.


Step 3: Install the Aspire Affiliates App

  1. Open the Aspire Affiliates App in the Shopify App Store.

  2. Click Install.

  3. Accept the requested permissions.


Step 4: Enable Link Tracking + Affiliate Features

Link Tracking allows Aspire to attribute affiliate link clicks and conversions using Shopify App Pixels.

In Shopify:

  1. Go to Settings Apps.

  2. Select the Aspire Affiliates App.

  3. Under Features, click Enable beneath Link Tracking.


    ​Don't see Link Tracking as an option? Contact your Aspire representative or Aspire Support to have the feature enabled for your account.

  4. You can also enable Offer Landing Pages and SecureCodes if you plan to use those features.

  5. Once Link Tracking is enabled, place a test order to verify that conversions are being recorded correctly.

Important: Keep any existing Aspire tracking scripts or custom pixels in place until you've confirmed that the Shopify App Pixel is firing correctly and test conversions are being recorded. After verification, you can safely remove the old tracking implementation.


Headless Storefronts

If you're using a headless storefront (such as Next.js or React) with Shopify Checkout, additional implementation steps are required for affiliate link attribution.

Why Additional Setup Is Required

A headless store uses a custom front end for browsing while Shopify hosts the cart and checkout. Aspire affiliate links include a ?transaction_id=... parameter. Because customers land on your custom storefront instead of Shopify, Shopify's checkout pixel cannot access this value directly.

To preserve attribution:

  1. Capture the transaction_id from the landing URL.

  2. Save it to the Shopify cart as a cart attribute (_tune_txn_id).

  3. Read that cart attribute during checkout and send it with the conversion event.

Developer Setup Instructions

After installing the Aspire Affiliates App and enabling Link Tracking, ask your dev team to complete the following implementation.

Part 1: Update Your Headless Storefront (Next.js)

Create a helper that:

  • Captures the transaction_id URL parameter.

  • Stores it in local storage.

  • Writes it to the Shopify cart as the _tune_txn_id cart attribute.

Before using the sample code below:

  • Replace YOUR_STORE.myshopify.com with your Shopify domain.

  • Replace YOUR_PUBLIC_STOREFRONT_API_TOKEN with your Storefront API token.

  • Use the same Storefront API version as the rest of your cart implementation.

// lib/tune-cart-sync.js
// Bridges affiliate attribution from the headless storefront into the
// Shopify checkout. Affiliate links land with ?transaction_id=... in the URL.
// We capture it, persist it, and stamp it onto the Shopify cart as the
// `_tune_txn_id` attribute so the checkout pixel can read it and fire the
// conversion.

const STORE_DOMAIN = 'YOUR_STORE.myshopify.com';
const STOREFRONT_API_TOKEN = 'YOUR_PUBLIC_STOREFRONT_API_TOKEN';
const STOREFRONT_API_VERSION = '2025-01'; // match your existing cart calls

const URL_PARAM = 'transaction_id'; // stays as-is in the affiliate URL
const STORAGE_KEY = 'tune_transaction_id'; // internal localStorage key
const CART_ATTRIBUTE_KEY = '_tune_txn_id'; // MUST match the checkout pixel

const CART_ATTRIBUTES_UPDATE = `
mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!) {
cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {
cart { id }
userErrors { field message }
}
}
`;

// Capture ?transaction_id=... from the landing URL and persist it.
export function captureTuneTransactionId() {
if (typeof window === 'undefined') return;
const fromUrl = new URLSearchParams(window.location.search).get(URL_PARAM);
if (fromUrl) localStorage.setItem(STORAGE_KEY, fromUrl);
}

// Read the persisted id (falls back to the current URL).
export function getTuneTransactionId() {
if (typeof window === 'undefined') return null;
return (
localStorage.getItem(STORAGE_KEY) ||
new URLSearchParams(window.location.search).get(URL_PARAM)
);
}

// Stamp the transaction id onto the given Shopify cart. Best-effort:
// never throws, so it can't break the add-to-cart flow.
export async function syncTuneTransactionIdToCart(cartId) {
try {
if (!cartId) return;
const transactionId = getTuneTransactionId();
if (!transactionId) return;

const res = await fetch(
`https://${STORE_DOMAIN}/api/${STOREFRONT_API_VERSION}/graphql.json`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Shopify-Storefront-Access-Token': STOREFRONT_API_TOKEN,
},
body: JSON.stringify({
query: CART_ATTRIBUTES_UPDATE,
variables: {
cartId,
attributes: [{ key: CART_ATTRIBUTE_KEY, value: transactionId }],
},
}),
}
);

const data = await res.json();
const errors = data?.data?.cartAttributesUpdate?.userErrors;
if (errors?.length) console.warn('[Tune] Cart attribute errors:', errors);
} catch (err) {
console.error('[Tune] Failed to sync transaction id to cart:', err);
}
}
Wire it in with two calls - capture on every page load, and stamp the cart after it's created:
// 1. Capture on every page load - in pages/_app.js
import { useEffect } from 'react';
import { captureTuneTransactionId } from '../lib/tune-cart-sync';

export default function MyApp({ Component, pageProps }) {
useEffect(() => { captureTuneTransactionId(); }, []);
return <Component {...pageProps} />;
}

// 2. Stamp the cart - right after cartCreate / cartLinesAdd resolves
import { syncTuneTransactionIdToCart } from '../lib/tune-cart-sync';
await syncTuneTransactionIdToCart(cart.id);

Part 2: Update Your Shopify Checkout Pixel

In your existing Shopify Customer Events pixel:

  1. Read the _tune_txn_id cart attribute.

  2. Pass it into your conversion event as transaction_id.

Example:

// read the attribute the storefront stamped onto the cart
const attrs = event.data.checkout.attributes
?? event.data.checkout.customAttributes ?? [];
const transactionId = attrs.find(a => a.key === '_tune_txn_id')?.value;

if (!transactionId) return; // organic order, not affiliate-driven - skip

tdl.convert({
amount: cartSubtotalUSD, // your existing USD value
adv_unique1: event.data.checkout.order.id, // existing
transaction_id: transactionId, // <- the line that fixes attribution
});

Part 3: Implementation Checklist


Before testing, verify the following:

✅ The cart attribute key _tune_txn_id must be identical in your storefront implementation and checkout pixel. If the storefront writes one key and the pixel looks for another, affiliate conversions won't be attributed.

✅ The token in Part 1 is your Storefront API token (the one your cart code already uses), not your Shopify Admin API token.

Did this answer your question?