With the new SealMetrics pixel, you have complete control over measuring conversions and micro-conversions, ensuring accurate data collection while preventing unnecessary duplication of page view events. Every conversion or micro-conversion event must be linked to a pageview, but you can configure whether that pageview is triggered automatically or managed externally.
This guide explains how to configure your pixel for various use cases.
Key Configuration Options
Automatic Pageview Triggering: By default, the new pixel includes a pageview event when tracking conversions.
Excluding Pageview from the Conversion Pixel: You can avoid triggering an additional pageview event by adding the
ignore_pageview
parameter.
This flexibility ensures your tracking setup is tailored to your needs and avoids double-counting pageviews.
Use Cases
1. Tracking a Button Click (Avoiding Duplicate Pageviews)
If you're measuring an event like a button click on a page where the pageview has already been recorded, you should disable the pageview event in the conversion pixel. This prevents counting two pageviews for the same session.
Here’s how to configure the pixel:
<script>
/* SealMetrics Tracker Code */
(function() {
var options = {
account: 'YOUR_ACCOUNT_ID',
event: 'conversion',
label: 'button_click',
ignore_pageview: 1, // Avoids triggering a second pageview
use_session: 1,
};
var url="//app.sealmetrics.com/tag/v2/tracker";
function loadScript(callback){
var script=document.createElement("script");
script.src=url;
script.async=true;
script.onload=function(){
if(typeof callback==="function"){
callback();
}
};
script.onerror=function(){
console.error("Error loading script: "+url);
};
document.getElementsByTagName("head")[0].appendChild(script);
}
loadScript(function(){
options.id=Math.floor((Math.random()*999)+1);
if(window.sm){
var instance=new window.sm(options);
instance.track(options.event);
} else {
console.error("sm2 plugin is not available");
}
});
})();
</script>
2. Tracking a Conversion (Including Pageview)
If you need to include a pageview when tracking a conversion (e.g., a purchase confirmation page), simply omit the ignore_pageview
parameter. This ensures the pageview and conversion are both tracked accurately.
<script>
/* SealMetrics Tracker Code */
(function() {
var options = {
account: 'YOUR_ACCOUNT_ID',
event: 'conversion',
label: 'purchase',
use_session: 1, // Includes the pageview by default
};
var url="//app.sealmetrics.com/tag/v2/tracker";
function loadScript(callback){
var script=document.createElement("script");
script.src=url;
script.async=true;
script.onload=function(){
if(typeof callback==="function"){
callback();
}
};
script.onerror=function(){
console.error("Error loading script: "+url);
};
document.getElementsByTagName("head")[0].appendChild(script);
}
loadScript(function(){
options.id=Math.floor((Math.random()*999)+1);
if(window.sm){
var instance=new window.sm(options);
instance.track(options.event);
} else {
console.error("sm2 plugin is not available");
}
});
})();
</script>
How It Works
Default Behavior: The new pixel automatically tracks a pageview alongside any conversion or micro-conversion.
Customizing Behavior: You can prevent the pageview from being triggered by adding
ignore_pageview: 1
to the configuration.
Best Practices
Avoid Duplicate Pageviews:
If you're tracking an event (like a button click) on a page where the pageview has already been logged, use the
ignore_pageview
parameter to avoid double-counting.
Ensure Every Conversion Has a Pageview:
Every conversion or micro-conversion needs to be associated with a pageview. If you exclude the pageview from the conversion pixel, ensure it has already been triggered elsewhere in your setup.
Where to find Event pixels: