alby Purchase Pixel
Track and analyze customer purchases with alby's purchase pixel for e-commerce websites.
The alby Purchase Pixel allows you to track and analyze customer purchases within your site. By integrating this pixel onto your site, you can gather valuable data and insights on how alby performs with your website.
All customers will need to use the alby Purchase Pixel. Follow the below instructions to add the pixel to your site.
Prerequisite
Before proceeding with the installation, you must have a Brand ID (brand_id
). This unique identifier connects your website to alby. Reach out to your CSM or onboarding manager for this.
Add the alby Purchase Pixel to your website
To add the purchase confirmation pixel using JavaScript, locate the checkout screen and add the following code inside it:
<script>
var _ALBY_ORDER_INFO = {
brand_id: "PLACE_BRAND_ID_HERE",
order_id: "PLACE_ORDER_ID_HERE",
order_total: "PLACE_ORDER_TOTAL_HERE",
variant_ids: ["PRODUCT_IDS_HERE"],
currency: "PLACE_CURRENCY_HERE",
test_id: "PLACE_ID_HERE",
test_version: "PLACE_TEST_VERSION_HERE - alby OR control OR excluded"
test_description: "PLACE_TEST_DESCRIPTION_HERE"
};
var url =
"https://tr.alby.com/p?" +
(function (i) {
if (i instanceof Object) {
var s = [];
for (var o in i)
if (i[o]) {
var r = i[o],
e = encodeURIComponent(o) + "=" + encodeURIComponent(r);
s.push(e);
}
return s.join("&");
}
return "";
})(_ALBY_ORDER_INFO),
cookies = document.cookie.split(";"),
sessionCookie = cookies.filter(function (i) {
return i.trim().startsWith("_alby_session=");
})[0],
userCookie = cookies.filter(function (i) {
return i.trim().startsWith("_alby_user=");
})[0];
sessionCookie && (url += "&session=" + sessionCookie.split("=")[1]),
userCookie && (url += "&user_id=" + userCookie.split("=")[1]),
fetch(url);
</script>
Name | Required? | Description |
---|---|---|
brand_id | Yes | A unique identifier that connects your website to alby |
order_id | Yes | A unique identifier for the purchase |
order_total | Yes | The total amount of the purchase, rounded to the nearest whole unit of the respective currency |
variant_ids | Yes | A comma-delimited list of variant/child level product IDs shared with alby through your product catalog integration. alby requires purchases at a variant level for more robust conversion reporting. |
currency | Yes | The currency code (e.g., USD, EUR, GBP) in which the purchase was made. |
test_id | No | If alby is being A/B tested, provide a unique test ID to identify this test set so that alby can accurately track and report data specific to that version. |
test_version | No | If alby is being A/B tested, specify what A/B test condition this purchase occurred with. Possible values are alby, control, excluded alby - Any user assigned to the alby segment and is able to engage with alby. control - Any user assigned to the segment that is not able to see alby. excluded - Any remaining users that are not in the alby or control segment. |
test_description | No | If alby is being A/B tested, provide an optional description of the test. |
Save and Publish
Save the changes you made to your source code and publish your website. The alby Purchase Pixelwill now be fired on the checkout screen, capturing the necessary data for analysis.
If you encounter any issues, reach out to [email protected].
Updated about 1 month ago