Shopify is one of the most popular e-commerce systems that we see. Here are some details about how to integrate AvantLink into Shopify.
PLEASE NOTE: We provide this information "as-is" as a courtesy to our clientele, and as such, it may contain typos, get outdated, go out of style, be factually incorrect, or considered 'using cheats' if playing on hard mode. We cannot vouch for it's seaworthiness; sail at your own risk, and please email us with any improvements we can make!
Shopify's "How to add tracking" documentation can be found here:
Use our standard site-wide script:
Full Order Confirmation script, with Shopify variables in place, and the 'for each item' loop:
Please notice that here it shows product.id for the SKU, but you may need a different variable, such as line.sku if you use SKUs instead of Shopify's standard "Product IDs" on your datafeed that you provide us.
See this link for even more product-related details:
Note: The "Thank You" page via Shopify's platform, requires that the first snippet (standard site-wide Tracking Script) to be placed after the Order Confirmation script, in the "Additional content and scripts" text field. (This is because Shopify places all code in this text field below all html in the DOM. Therefore, to ensure the AvantLink library is referenced after the order tracking component it must be manually placed after the order tracking component in the "Additional content and scripts" text field.)
Note: A useful one may be "collections.title", as this is effectively a Category of items. By defining this, passing it to us (using the Liquid Template below, for example), we may be able to use that to target specific items, or create multiple datafeeds, etc.
Shopify Test Mode
Shopify provides a test mode. See here for more details:
This should fire any additional scripts -- just looks like it blocks the order from saving / reporting on their side.
Creating a Datafeed from your Shopify Inventory - Liquid Template:
This is the recommended process, but only works if you have less than 10k products. Please see the Shopify API version below, if you have a very large number of products.
- Log into your Shopify store.
- Select "Online Store" under Sales Channels.
- Select "Themes" from the menu that pops appears.
- On the right hand side of the themes page, click on the button with three dots. Select "Edit HTML/CSS" from the menu that appears.
- On the left hand side, under "Templates", click "Add a New Template"
- From the dropdown in the pop up that appears, select "collection". Type "csv" in the text box (replacing the word "alternate").
- Replace all of the code in collection.csv.liquid with the below code. Then click "Save" (top right corner).
- Mouse over the menu on the far left and click on "Products", then click "Collections" on the menu that appears.
- Click ‘Create collection’ in the top right corner.
- In the "Title" input, type in "avantlink datafeed". The "Description" input should be left blank.
- Below, under ‘Conditions’ choose ‘Automatically select products based on conditions.’
- Create a product condition such that product price is greater than -1. This is will make Shopify include all of the products in your shop.
- For ‘Theme Templates’, on the right-hand side, choose "collection.csv" from the dropdown. This will apply the liquid file we created to this new collection.
- Save your collection by clicking "Save collection" in the bottom right corner.
- Go to the top right corner of the page and click "View". This will open a new browser tab that will take you to the page where your datafeed is hosted.
- Copy the URL from your browser's address bar and send it to your AvantLink technical integration specialist (it should be something like https://your-domain.com/collections/avantlink-datafeed.
Congratulations! You have successfully set up your Shopify datafeed!
Creating a Datafeed - Shopify API:
This is a secondary method, which is a little more complicated, but is useful for large shops with more than 10k products.
To create that API key, you'll need to log in to your Shopify account and click Apps > Manage private apps > Generate API credentials. Under "Private app name", write "AvantLink Datafeed". Then in the Permissions section, set these two options to "Read access": "Store content like articles, blogs, comments, pages, and redirects", and "Products, variants and collections". Click Save.
Once that's done, it should take you to a page with info on the app you've just created, including an API key and Password. Send those to us, and we'll take care of the rest from there!
Still stumped? See Shopify Documentation Here