Track and analyze customer purchases with Alby's purchase confirmation pixel for ecommerce websites.
The Alby purchase confirmation pixel allows you to track and analyze customer purchases within your ecommerce website. By integrating this pixel onto your checkout screen, you can gather valuable data and insights on how Alby performs with your website. Follow the steps below to add the purchase confirmation pixel and pass the necessary variables.
Prerequisites
Before proceeding with the installation, make sure you have the following information ready:
- Your Brand ID (
brand_id
): This unique identifier connects your website to Alby. You can obtain this ID from your Alby contact.
To add the purchase confirmation pixel using JavaScript, follow these instructions:
- Open your website's source code.
- Locate the checkout screen code or the specific section where the purchase confirmation pixel should be placed.
- 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: ["VARIANT 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>
Configuring the Purchase Confirmation Pixel
brand_id
: Your Brand ID.order_id
: A unique identifier for the purchase.order_total
: The total amount of the purchase, rounded to the nearest whole unit of the respective currency.variant_ids
: A comma-delimited list of variant/child level product IDs shared with Alby through your product catalog integration. Alby wants to observe purchases at a variant level for more robust conversion reporting.currency
: The currency code (e.g., USD, EUR, GBP) in which the purchase was made.test_id
: (optional) If alby is being A/B tested, provide a unique test ID to identity this test set so that alby can accurately track and report data specific to that version.test_version
(optional) If alby is bring A/B tested, specify what A/B test condition this purchase occurred with. Possible values arealby
,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 is NOT in thealby
orcontrol
segment.
test_description
(optional) 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 purchase confirmation pixel will now be fired on the checkout screen, capturing the necessary data for analysis.
If you encounter any issues or have further questions, don't hesitate to reach out to our support team for assistance.