Route will track user behaviors through events and send automated messages based on them. Is all about people (who) behavior (what) in your website or application.
We offer basically 2 ways to track events:
- Visual Mode (for beginners)
- JavaScript/API (for advanced users)
Visual Mode
With our Visual Mode you can track events with no extra-coding. Here’s how it works:
- On your account go to events;
- Click Setup Events and choose Visual Mode;
- Paste the URL of the website you want to track and start the visual mode;
- When the Visual Mode opens right-click on the elements of your page you want to create an event for;
Javascript
Learn how to identify people and track their behavior with events using our JavaScript.
Main Script
The script below is required to be pasted on your website because it’s the only way Route will be able to recognize and trigger all the events you create and identifying all the people that fill in your forms.
We can track your users even when they’re redirect from another domain with our cross-domain tracking. You just need to make sure Route we’ll be on every domain you want to track.
You should put this code right above the of your HTML so it’s rendered before all the other Route scripts you’ll put on your website’s HTML.
IMPORTANT! If you want to copy and paste the code above you must replace ‘YOUR ORGANIZATION_ID’ with your own Organization ID that you can find under Settings in Route.
Identify Contacts
Use the following code to identify people using Route:
You’ll need to replace the “var contact” name and email we used in our sample code for a rule to instruct Route to collect this information from the forms you have in your website, just like the example bellow:
You can also get this information by rendering it from your server-side, specially if you are using Route on an app.
If you want you can get contact attributes when identifying them.
Track Events
Having only the main script on your website won’t give you information about your user’s behaviors, you need something else.
What you need is to track their behavior with the following event tracking script:
With the code above you’ll track what people are doing on your website or app. You can use it as follow:
- Using the onClick method on a button or link;
- Right inside thetag (this will work as a pageview);
- Using the onSubmit method on a form.
- The event tracking script is only one part of the equation, capturing what people are doing in your website or app.
Route will store this information but will only show you who is doing what if you get names and emails of your contacts and identify them within our software.
Track Pageviews
Route doesn’t have a custom pageview method yet.
To track pageviews with Route JavaScript just paste our _route("track", "Visited " + window.location.pathname)
code just before the </body>
tag on the page you want to track the pageview.
This will trigger an event like any other event, the difference is it will only fire on that specific page.
It will emulate a pageview.
HTTP API
All requests must contain the Authorization header with your organization id and api key encoded with base64.
You can find your organization id and API key at your Organization Settings.
Example:
Authorization:Basic base64(organization_id:api_key)
HTTP API – GET
Get all contacts
GET http://routeapi.com/v1/contacts
Get a specific contact
GET http://routeapi.com/v1/contacts/{contact_id}
Or
GET http://routeapi.com/v1/contacts/{contact_email}
HTTP API – POST
Create a new contact
POST http://routeapi.com/v1/contacts
{ name: "John Mclane", email: "[email protected]", phones: "5552451" company: "NYPD", attributes: "{ job: 'cop', quote: 'Yippie Ki-Ay, ...'}" //a stringified json object }
HTTP API – PUT
Edit an existing contact
PUT http://routeapi.com/v1/contacts/{contact_id}
{
name: "John Mclane",
company: "NYPD",
attributes: "{ job: 'cop', quote: 'Yippie Ki-Ay, ...'}" //a stringified json object
}
Or
PUT http://routeapi.com/v1/contacts/{contact_email}
{ name: "John Mclane", company: "NYPD", attributes: "{ job: 'cop', quote: 'Yippie Ki-Ay, ...'}" //a stringified json object }
Tracking an event
PUT http://routeapi.com/v1/contacts/{contact_id}/events
{
eventname: "Arrest Bad Guys",
attributes: "{ amount: 'A dozen' }"
}
Or
PUT http://routeapi.com/v1/contacts/{contact_email}/events
{ eventname: "Arrest Bad Guys", attributes: "{ amount: 'A dozen' }" }
Next: Integrating with Forms.