Logging events to Google Analytics

Logging view events

By listening to Triggerbee Onsite Campaign events, data can be sent to Google Analytics when a campaign is opened (eg. visitor viewed the campaign), a campaign is closed, submitted etc. 

All Triggerbee events and event data can be found here: https://help.triggerbee.com/article/346-onsite-campaigns-javascript-api

Full example:

document.addEventListener("onTriggerbeeWidgetOpened", function (event) {
	ga('send', 'event', {
		eventCategory: 'Triggerbee',
		eventAction: 'Campaign Viewed',
		eventLabel: event.detail.campaignName
	});
});

Logging click events

Inside Triggerbee Onsite Campaigns, when using buttons in your campaign, scripts can be added to execute on click. This way, you can send data to Google Analytics when buttons in your campaign are clicked.

This is done by adding a full GA tracker event (in example above), or - if you want to minimize code, using the short version:

ga('send','event','Triggerbee','Button Clicked','Winter Campaign');

Still need help? Contact Us Contact Us