Tracking using ad visibility
Experimental features are subject to change
Browser support
Viewability can be split into two separate scenarios:
- Unfriendly iframe tracking: Ads are usually served using cross-domain iframes, meaning that the javascript can't access the parent and thus won't know its visibility. There are many workarounds to this, but we only implement the official solution: IntersectionObserver. Currently that solution is supported by 75%+ of users, and for the rest we will send an error event (id 90).
- Same domain tracking: This is typically the case when tracking a page you own. Here we use IntersectionObserver with a fallback method allowing us to track 99%+ of all users.
Example
Copy paste the code snippet below into your ad/page and follow the instruction to customize the events you want to send.
<script>
window._ca = window._ca || function(){(_ca.e=_ca.e||[]).push(arguments)};
_ca('my-ad-id', 42, 5, 1, [{p: 50, t: 1000, e: 1}]);
</script>
<script src="https://collector.azureedge.net/ca-0.4.js" async defer></script>
Description of parameters:
_ca(
The id of the element. For same domain tracking this element can't be in an iframe,
Your account id,
The campaign id,
The channel,
A list of all triggers for this ad, with each element containing the following data:
p: How many percent of the ad needs to be visible to trigger the event,
t: For how long in ms the ad needs to be at least *p*% visible,
e: The event to send (1 for views, 2 for clicks, 100+ for custom events)
);
Example:
_ca('my-ad-id', 42, 5, 1, [{p: 50, t: 1000, e: 1}]);
The example above will send event 1 (view) on channel 1 once the element has been at least 50% visible for 1 second. You can add as many tracking points and elements as you want. Please note that you need to add a trigger for the view event (1) in the list as it doesn't happen automatically.
The MRC standard for ad visibility is at least 50% visible for at least 1s, or 2s if the ad is a video.
Manually sending events
If needed you can manually send events from your own code. Description of parameters:
_ca(
Your account id,
The campaign id,
The channel,
The event
);
Updated about 4 years ago