The agent does not track anything unless told to. It can track a
page and units on that page. The
tracking is configured using our API. The API is
accessible via the api
variable in the startTracking
block:
window.burtApi.startTracking(function(api) {
api.setTrackingKey('KEY', 'WEBSITE NAME');
api.setDomain('yousite.com');
// configure tracking here
});
In this example, the only thing that is tracked is the page. If the
page also happens to be an article, it is
annotated with the author Joe
.
window.burtApi.startTracking(function(api) {
api.setTrackingKey('KEY', 'WEBSITE NAME');
api.setDomain('yousite.com');
if (location.pathname.match(/^\/article/)) {
api.annotate('burt.author', 'author', 'Joe');
}
});
Call startUnitTracking
to track all
<div>
-tags on the page that have the class burt-unit
.
window.burtApi.startTracking(function(api) {
api.setTrackingKey('KEY', 'WEBSITE NAME');
api.setDomain('yousite.com');
api.startUnitTracking();
});
This is an example of a Burt unit:
<div class="burt-unit" data-name="my-unit">
<!-- content -->
</div>
Notice the data-name
attribute, it is a attribute of units and tells the
agent what that units name is. You can specify other information too, see
the API for how to do that.
You might already have a class set on the DIV
tags surrounding your ads, in
which case you can re-use these instead of adding the burt-unit
class. To
do this you need to add each unit to the configuration and specify its name.
This is an example of how to do that using jQuery:
window.burtApi.startTracking(function(api) {
api.setTrackingKey('KEY', 'WEBSITE NAME');
api.setDomain('yousite.com');
$('.ad').each(function(ad) {
api.trackByNode(ad, { name: $(ad).attr('id') });
});
});
Notice that all units are required to have a name. In the example above, it
is simply the id of the DIV
tag.
One of Burt’s coolest features is campaign reporting. If you want to integrate with this product you can do that by connecting the campaign ID to which an ad belongs to the unit.
In this example, the call to start the unit tracking is most likely
added to the ad server template. In that case there is no access to the api
variable, as in the configuration examples above. Instead you can use the
window.burtApi
variable directly:
unit = window.burtApi.trackById('ad-id', { name: 'ad-id' });
unit.connect('burt.campaign', 'campaign-id', 'id-of-my-campaign');
The campaign id is usually accessible using a macro in the ad template.
The Burt API has a lot more to offer. Please refer to the API documentation for more information.
Thanks for following along the tour and good luck with the integration. And remember, don’t hesitate to contact us if you have any questions.