Sending data to Triggerbee

Out of the box Triggerbee records the traffic on the pages you added the script to. Triggerbee records pageviews, time on site, clicks on outbound links, referral source etc. Triggerbee also offers an option of automatically listening to the existing forms on your site, extracting field values such as email adress and name. In this section we will talk about the possibilities of sending extra data to Triggerbee using our simple to use javascript API.

Logging Events & Goals

Events and Goals are an important part of Triggerbee since. You may have an ordering process that includes adding products to the cart, entering order details and finally making the purchase. Triggerbee lets you log events of every action.

Events that are particular important and positive should be logged as a goal. Those visits get a medal in the list.

We recommend you to define your goals in Triggerbee (based on url) but you can also log goals using our javascript API. If the goal does not exist, it will automatically be created in Triggerbee upon fulfillment by the first visitor.

To log goals and events on page load use mtr.custom variable to configure the logging variables.

To log goals and events on user interaction, such as clicking on buttons, scrolling, use the mtr.log(), mtr.event() and mtr.goal() methods. These methods are available after the tracking code is registered.

Custom Event logging

mtr.log sends a Page View-event directly to Triggerbee servers:

mtr.log("URL","TITLE", "NAME");
mtr.log("/services");

Logging a simple event

Events appears below the URL of the previous logged pageview.

mtr.event( "Filled out form field");
mtr.event("Clicked on button");
mtr.log(null, "50%", "scroll");

Set a customized URL

Triggerbee lets you customize the url that is logged. This can be useful if your site contains different views shown under the same url. Also, if you wish to log different areas of the page, such as scroll position, or any other events for that matter.

Examples (javascript):

Customize the current url:

var mtr_custom = mtr_custom || {};
mtr_custom.href = "/webshop/payment-details";

When using the mtr_custom object, make sure the code is executed before the Triggerbee tracking code.

Setting identity - converting visitor

Do you have information about the visitor that you want to send to Triggerbee? Tagging users by form values is the most common implementation of this feature. The following properties are supported and presented in Triggerbee:

  • email
  • name
  • organization
  • telephone
  • title
  • username

This data will remain active until the user changes or removes the corresponding cookie.

Example of how to identify a visitor:

var mtr_custom = mtr_custom || {};mtr_custom.session = { name: "Erlich Bachman", email: "erlich@piedpiper.com", organization: "Piep Piper LTD"};

Another example:

var mtr_custom = mtr_custom || {};
mtr_custom.session = { email: "erlich@pipedpiper.com" };
mtr.goal("Logged on");

To send data directly to Triggerbee, call on the mtr.log or mtr.goal events after setting the session-custom properties.

More Examples

NOTE: The mtr. – methods can be used after the tracking code is registered.

Log event

mtr.log(null, "Filled out textfield", "event");

On a thank you page / order confirmation page we can log the page as a goal like this (on PageLoad):

mtr_custom.goal = { name: 'Order' };

Keep track of the price:

mtr_custom.goal = { name: 'Order' , revenue: '1495' };

Simple Goal event logging (sends the goal event directly to Triggerbee servers)

mtr.goal('Order');

Goal event logging with revenue

mtr.goal("Purchase", 1595);

Log goal event when click on button

<button onclick="mtr.goal('Order');">Order</button>

Inject a logging event using jQuery

    var loginHref = $('.top-links > li').last().find("a");
     if(loginHref)
         loginHref.attr("onclick", "mtr.goal('Clicked on login link');"); 

Injecting logging on multiple navigation links 

Check out this example here.