Integrating with Shopify

To start tracking customer behavior, conversion rates, return on ad spend, and other essential metrics on your Shopify store, you’ll need to integrate with our platform. Follow these steps to ensure a seamless integration:

Add Armanet SDK

To enable full functionality, including detailed conversion tracking and customer behavior analysis, you need to include our script in your store’s HTML <head> section.

  1. In your Shopify Admin Panel, go to Online Store > Themes.
  2. Click on Actions for your active theme and select Edit Code.
  1. In the left sidebar, locate and select the theme.liquid file under the Layout section.
  2. Find the closing </head> tag in the file.
  1. Just before the closing </head> tag, paste the following script:
<script src="https://assets.armanet.us/armanet-pxl.js" defer></script>
  1. Click Save to apply the changes.

Create a Custom Pixel in Shopify

  1. Log in to your Shopify Admin Panel.
  2. Navigate to Settings in the lower-left corner.
  1. Select Customer events from the available options.
  2. Click on Create Custom Pixel.
  3. You will be prompted to paste a piece of code into the pixel. Copy and paste the following code:
const injectScript = (document, onLoaded) => {
  const script = document.createElement('script');
  script.src = 'https://assets.armanet.us/armanet-pxl.js';
  script.type = 'text/javascript';
  script.defer = true;
  script.onload = onLoaded;
  document.head.append(script);
};

analytics.subscribe('checkout_completed', (event) => {
  injectScript(document, () => {
    const checkout = event.data.checkout;
    const orderTotal = checkout.totalPrice.amount;
    const items = checkout?.lineItems?.map((item) => ({
      itemId: item?.id,
      upc: item?.variant?.sku,
      quantity: item?.quantity,
      price: item?.cost?.totalAmount,
    }));

    Armanet.sendEvent('purchased', {
      orderNumber: checkout?.order?.id,
      orderTotal,
      items,
    });
  });
});

analytics.subscribe('checkout_started', (event) => {
  injectScript(document, () => {
    Armanet.sendEvent('checkoutStarted');
  });
});
  1. Click Save to create the pixel. This pixel will now track key metrics and send them to our platform for processing.