More Javascript Examples

More Examples

NOTE: The mtr. – methods can be used after the tracking code is registered. If you haven't installed the Triggerbee tracking code on your website,  click here for instructions.

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)


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 on Login link using jQuery

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

Logging goals on button click (with jQuery)

$("button.btn-primary").click(function(){ mtr.goal("Contact form")});
Did this answer your question? Thanks for the feedback! Please reach out to [email protected] if there's anything you'd like to add. There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us