Shopify Custom Web Pixel
The Eulerian integration for Shopify consists of manually inserting JavaScript code as a custom pixel. It automatically collects page views, add-to-basket events and purchases, then sends this data to the Eulerian platform.
Note
It is not an app published on the Shopify App Store.
Prerequisites
- Administrator access to your Shopify store
- Your Eulerian tracking subdomain
- The shopify-web-pixel-eulerian-marketing-platform (opens in a new window) repository, which contains the script to copy
Importing the Eulerian template
Get the full code from snippet/generic.js in the repository.
Configuring the tag
- Enter your Eulerian tracking subdomain in the script’s
CONFIGconstant. - In the Shopify admin, go to Settings > Customer events, then Custom pixels > Add pixel.
- Paste the full JavaScript code there.
Configuring the triggers
Triggers are not configured one by one: the script relies on Shopify’s Web Pixels API and subscribes to the events itself.
When it loads, it imports the Eulerian tracking script (ea.js), then subscribes to the standard events page_viewed, product_viewed, product_added_to_cart and checkout_completed.
For each event it receives, it builds a parameter array and calls window.EA_collector, which sends the data to Eulerian:
- for a page view, it sends the customer identifier and the event type;
- for an add to basket, it sends the product’s identifier, name, price and category;
- for a purchase, the
handleCheckoutCompletedfunction builds anEA_datalayerarray with the customer identifier (uid), the event type, the order reference, the amount, the currency and the items bought.
The dataLayer is therefore created by the script: you do not have to set it up yourself.