This guide will cover how to implement the Analytics.js SDK for MetaRouter and begin sending events into your MetaRouter cluster from your website. This is the easiest MetaRouter install and can generally be completed in minutes, assuming you have already created your Data Infrastructure.
Once the snippet is placed on your website within the
<head> tag, you will be ready to trigger events from your website:
Note that there are two edits you need to make to the above snippet:
- Your CDN URL, which is where the analytics.js file the snippet calls to is located. You will need to determine your preferred DNS settings prior to setting the CDN URL and adding the snippet. Please see this guide for more information.
- Your writeKey, which will be determined as a part of your MetaRouter cluster setup.
Default Page Events
The snippet above includes the
analytics.page() function, which will automatically trigger Page calls. You can remove this function from the snippet if you do not want to trigger Page calls on every webpage loaded on your website. We recommend leaving this function in the snippet in most cases.
With the following events, you can track almost any kind of action being taken and consistently identify the users on your website. Check out each event type below to learn more about when to trigger them and what to include with each event.
Updated 2 months ago