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.
- In your Shopify Admin Panel, go to Online Store > Themes.
- Click on Actions for your active theme and select Edit Code.
- In the left sidebar, locate and select the theme.liquid file under the Layout section.
- Find the closing
</head>
tag in the file.
- Just before the closing
</head>
tag, paste the following script:
<script src="https://assets.armanet.us/armanet-pxl.js" defer></script>
- Click Save to apply the changes.
Create a Custom Pixel in Shopify
- Log in to your Shopify Admin Panel.
- Navigate to Settings in the lower-left corner.
- Select Customer events from the available options.
- Click on Create Custom Pixel.
- 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');
});
});
- Click Save to create the pixel. This pixel will now track key metrics and send them to our platform for processing.