Setting up pixel for tracking standard ecommerce signals
This guide will help you set up the Sygnal Pixel for tracking on your website. The Sygnal Pixel functions similarly to the Facebook Pixel but uses the rrq
function call instead of fbq
.
#Step 1: Copy the Tracking Code
First, copy the tracking code provided by Sygnal.io, including your unique Brand ID. Insert this code snippet into the <head> section of your HTML:
<!-- Sygnal Pixel Code -->
<script>
!(function () {
"use strict";
!(function (n, t) {
var r = [];
n.rrq =
n.rrq ||
(function () {
function n() {
r.push(arguments);
}
return (n.q = r), n;
})();
var c = t.createElement("script");
(c.async = !0),
(c.src = "https://unstable.cdn.sygnal.io/s/events.js"),
(c.id = "rrq"),
t.head.appendChild(c);
})(window, document);
})();
rrq("init", "YOUR_BRAND_ID");
</script>
<!-- End Sygnal Pixel Code -->
#Step 2: Initialize the Sygnal Pixel
To initialize the Sygnal Pixel, you need to call the init method with your Brand ID. This should already be included in the code snippet you added to the <head> section:
rrq("init", "YOUR_BRAND_ID");
#Step 3: Track Page Views
To track page views, include the following line after initializing the pixel:
rrq("track", "PageView");
Example:
<script>
rrq("init", "YOUR_BRAND_ID");
rrq("track", "PageView");
</script>
#Step 4: Track Events with Metadata
You can track various signals like ViewContent
, AddToCart
, etc., by using the track method. Events can include metadata as an object. Here are examples:
View Content
rrq("track", "ViewContent", {
content_name: "Example Product",
content_ids: ["12345"],
content_type: "product",
});
Add to Cart
rrq("track", "AddToCart", {
content_name: "Example Product",
content_ids: ["12345"],
content_type: "product",
value: 19.99,
currency: "USD",
});
#Step 5: Track Purchases
When tracking purchases, you must include an order_id for deduplication. Here’s how to track a purchase signal:
rrq("track", "Purchase", {
order_id: "ORDER12345",
value: 99.99,
currency: "USD",
content_ids: ["12345", "67890"],
contents: [
{ id: "12345", quantity: 1 },
{ id: "67890", quantity: 2 },
],
});
#Summary
- Initialize the Sygnal Pixel:
rrq('init', 'YOUR_BRAND_ID');
- Track Page Views:
rrq('track', 'PageView');
- Track Events: Use
rrq('track', 'EventName', {metadata});
- Track Purchases: Must include
order_id
for deduplication.
By following these steps, you can effectively set up and utilize the Sygnal Pixel for tracking user interactions on your website.