Skip to main content
All CollectionsMeasurment optionsSite Tracker Tag
Measure events with the Site Tracker Tag
Measure events with the Site Tracker Tag
TrafficGuard Support avatar
Written by TrafficGuard Support
Updated over a year ago

TrafficGuard supports the sending of custom events, including conversions, from your website. These events can then be analysed and reported on.


๐Ÿ’ก Tip
Sending events is only possible after the Site Tracker Tag is initialised (and initial pageview event is sent)


Sending events

Events are sent by adding event snippets to your website. These snippets contain an event name and event params.

Example snippet:

dataTrafficGuard.push(['event', 'event_name', 'eventParam']);

Basic event

Example snippet - 'checkout' event:

dataTrafficGuard.push(['event', 'checkout', 'eventParam']);

Event with additional parameters

Additional parameters can be passed as an array in the 'eventParam' value.

Example snippet - 'checkout' conversion event with revenue:

dataTrafficGuard.push(['event', 'checkout', '{"event_revenue_usd":"19.95", "is_conversion" : 1}']);

Event with additional parameters in json array

Additional parameters can also be defined as a javascript array and the Site Tracker Tag will pass it to the event snippet.

Example snippet with javascript array - 'checkout' conversion event with revenue and user ID:

var goalParams = {
is_conversion: 1,
event_revenue_usd: "19.95",
user_id: "123"
};


dataTrafficGuard.push(['event', 'checkout', goalParams]);

Example on-click event

Example of adding a 'share' event snippet as a on-click event.

<div>
<button onclick="sendCustomEvent();"> Send Custom Event </button>
</div>

<script>
function sendCustomEvenType() {
dataTrafficGuard.push(['event', 'share', 'eventParam']);
}
</script>

Example on-load event

Example of adding a 'purchase' event snippet as a on-load event.

<body onload="sendCustomEvent();">
<!-- web page content -->
<script>
function sendCustomEvenType() {
dataTrafficGuard.push(['event', 'purchase', 'eventParam']);
}
</script>
</body>

TrafficGuard event names

TrafficGuard accepts the following event names.

Event names are case sensitive.

pageview

registration

addtocart

checkout

purchase

login

invite

achievement

share

search

goal

TrafficGuard event parameters

See the developer reference docs for a full list of available event parameters

Did this answer your question?