JavaScript Library
Our JavaScript library allows you to easily track the actions of your customers using our predefined functions. It is a fully featured and supported library that we highly recommend to our customers.
First Step
You very first step after registering for FoxMetrics is to install your JavaScript tracking snippet on your website which you can find within your dashboard. This script will asynchronously load your custom script that is just for you and any additional modifications. It will look something similar to this:
<!-- FoxMetrics Web Analytics Start --> <script type="text/javascript"> var _fxm = _fxm || {}; _fxm.events = _fxm.events || []; (function () { var fxms = document.createElement('script'); fxms.type = 'text/javascript'; fxms.async = true; fxms.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'd3316uyqscnvke.cloudfront.net/scripts/--*your app id here*--.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(fxms, s); })(); </script> <!-- FoxMetrics Web Analytics End -->
How it works
Once you have your unique script installed on your website, you are all set. The script will automatically start tracking all traditional web analytics metrics such as page views, downloads, visits and more. We understand that you may not need those or you just want to use your requests wisely, therefore, you can easily turn off auto tracking from your dashboard with a single click.
Custom Events
Tracking a custom event with any number of attributes is very simple. When we receive an event with a name that does not start with _fxm it is automatically tracked as a custom event.
<script type="text/javascript"> /// <summary> /// Send in a custom event /// </summary> /// <param name="eventname">The name of the event</param> /// <param name="eventgroupname">The group name for this event. (optional)</param> /// <param name="attributes">object with additional data (optional)</param> /// <returns></returns> // structure _fxm.events.push(['<event name>', '<event group name>', '{<attributes>}']); </script>
Events per business type
To save you some time and money, we have built in predefined custom events for virtually any business type, these events will allow us to create powerful reports based on your business type.
Customer Profile
Regardless of how little of a data you have for your customers, you will want to keep their profile up to date and here is how you'll do it.
<script type="text/javascript"> /// <summary> /// Update customer profile /// </summary> /// <param name="id">unique id of customer</param> /// <param name="firstname">customer first name</param> /// <param name="lastname">customer last name</param> /// <param name="email">customer email</param> /// <param name="address">object with address info {state, city, country, zip}</param> /// <param name="social">object with social details {facebook, twitter}</param> /// <param name="partners">object with partner ids {salesforce, mailchimp}</param> /// <param name="attributes">object with additional data</param> /// <returns></returns> // structure _fxm.events.push(['_fxm.visitor.profile', '<id>', '<firstname>', '<lastname>', '<email>', '{<address>}', '{<social>}', '{<partners>}', '<attributes>']); </script>
Page Views
We also track traditional web analytics that we believe are still useful. Page views are automatically tracked on page load, however, you are free to send additional page views as you see fit.
<script type="text/javascript"> /// <summary> /// Sends a page view event /// </summary> /// <param name="title">the html title of this page</param> /// <param name="name">the name of this page</param> /// <param name="categoryName">the page category name</param> /// <param name="url">the url of the page</param> /// <param name="referrer">the referring url of this page view</param> /// <returns></returns> // structure // (title, name, categoryName, url, referrer) _fxm.events.push(['_fxm.pages.view', '<title>', '<name>', '<categoryName>', '<url>', '<referrer>']); </script>
Errors
Errors are known to be a hiderance of success and silent killers to your business as your customers may leave if they experience one or more errors. Use this event to track and analyze your errors.
<script type="text/javascript"> /// <summary> /// Sends a error event /// </summary> /// <param name="message">a descriptive message for this error</param> /// <param name="code">a unique code to this error</param> /// <param name="category">a category name for this type of error</param> /// <returns></returns> // structure // (message, code, category) _fxm.events.push(['_fxm.pages.error', '<message>', '<code>', '<category>']); </script>
Exits
Sometimes you want to know which pages most of your visitors leave from and where they head off to. We automatically track these for you by default, however, you can track additional exits if you need to.
<script type="text/javascript"> /// <summary> /// Sends a exit event /// </summary> /// <param name="id">the HTML element id that the visitor clicked on</param> /// <param name="href">the destination url they are going to</param> /// <returns></returns> // structure // (id, href) _fxm.events.push(['_fxm.pages.exit', '<id>', '<href>']); </script>
Downloads
Do you offer content for downloads such as music, documents and etc. We can track those too and present you with metrics such as the number of times a specific file was downloaded. Downloads are also tracked automatically by default.
<script type="text/javascript"> /// <summary> /// Sends a error event /// </summary> /// <param name="id">the HTML element id that the visitor clicked on</param> /// <param name="href">the url of the file that they downloaded</param> /// <returns></returns> // structure // (id, href) _fxm.events.push(['_fxm.content.download', '<id>', '<href>']); </script>
Articles
Mostly for bloggers and news publishers, our article tracking feature allows us to provide you with metrics on articles, authors, topics and more.
<script type="text/javascript"> /// <summary> /// Sends a article view event /// </summary> /// <param name="title">the title of this article</param> /// <param name="topic">the topic of this article</param> /// <param name="author">the author of this article</param> /// <param name="pubdate">the date this article was published</param> /// <param name="attributes">an object with additional data</param> /// <returns></returns> // structure // (title, topic, author, pubdate, attributes) _fxm.events.push(['_fxm.articles.view', '<title>', '<topic>', '<author>', '<pubdate>', '{<attributes>}']); </script>
Subscriber Sign Up
Purely for Saas owners, be it a complete web service or just a newsletter. We can track all the activities of your subscribers and provide actionable reports such as churn rate, activation rate and more.
<script type="text/javascript"> /// <summary> /// Sends an event when a new subscriber signs up /// </summary> /// <param name="planName">the name of the plan</param> /// <param name="planCost">the cost of the plan</param> /// <param name="trialDays">the number of days in trial</param> /// <param name="attributes">an object with additional data</param> /// <returns></returns> // structure // (planName, planCost, trialDays, attributes) _fxm.events.push(['_fxm.subscriber.signup', '<planName>', '<planCost>', '<trialDays>', '{<attributes>}']); </script>
Subscriber Activate/Cancel/PlanChange
Send in one of these events when a subscriber activates, cancels or changes plans.
<script type="text/javascript"> /// <summary> /// Sends an event when a subscriber activates/cancels or changes plan /// </summary> /// <param name="planName">the name of the plan</param> /// <param name="planCost">the cost of the plan</param> /// <param name="attributes">an object with additional data</param> /// <returns></returns> // structure // (planName, planCost, attributes) _fxm.events.push(['_fxm.subscriber.activate', '<planName>', '<planCost>', '{<attributes>}']); // OR _fxm.events.push(['_fxm.subscriber.cancel', '<planName>', '<planCost>', '{<attributes>}']); // OR _fxm.events.push(['_fxm.subscriber.planchange', '<planName>', '<planCost>', '{<attributes>}']); </script>
Subscriber Charge
We want to know when you charge your subscribers so that we can create reports that show powerful metrics such as the most valuable subscriber and their life time value.
<script type="text/javascript"> /// <summary> /// Sends an event when you charge a subscriber /// </summary> /// <param name="amount">the amount for this charge</param> /// <param name="reason">the reason for charging the customer</param> /// <param name="attributes">an object with additional data</param> /// <returns></returns> // structure // (amount, reason, attributes) _fxm.events.push(['_fxm.subscriber.charge', '<amount>', '<reason>', '{<attributes>}']); </script>
Application Use
Do you know which features are being used the most within your application? If you don't, then we can help you with that - use this event to notify use when a customer uses a feature and we will analyze and create reports that will show you detail insights into your modules and usages.
<script type="text/javascript"> /// <summary> /// Sends an event when a customer uses a feature in your app /// </summary> /// <param name="group">the group name for this feature</param> /// <param name="module">the name of the module</param> /// <param name="action">the action that was performed on the module</param> /// <param name="attributes">an object with additional data</param> /// <returns></returns> // structure // (group, module, action, attributes) _fxm.events.push(['_fxm.application.use', '<group>', '<module>', '<action>', '{<attributes>}']); </script>
Ecommerce Product View
Specially molded for online stores, use this event to let us know when customers view your products.
<script type="text/javascript"> /// <summary> /// Sends an event when a customer views a product /// </summary> /// <param name="id">the unique id for this product such as SKU</param> /// <param name="name">the name of the product</param> /// <param name="categoryName">the category name that this product is assigned</param> /// <returns></returns> // structure // function (id, name, categoryName) _fxm.events.push(['_fxm.ecommerce.productview', '<id>', '<name>', '<categoryName>']); </script>
Ecommerce Remove Cart Item
Should be used to notify us when a customer removes an item from their shopping cart.
<script type="text/javascript"> /// <summary> /// Sends an event when a customer removes an item from their shopping cart /// </summary> /// <param name="id">the unique id for this product such as SKU</param> /// <param name="name">the name of the product</param> /// <param name="categoryName">the category name that this product is assigned</param> /// <returns></returns> // structure // function (id, name, categoryName) _fxm.events.push(['_fxm.ecommerce.removecartitem', '<id>', '<name>', '<categoryName>']); </script>
Ecommerce Product Review
When a customer rates or leaves a review/feedback for your product we want to know about it. We can provide product effectiveness reports that will be helpful to your business.
<script type="text/javascript"> /// <summary> /// Sends an event when a customer removes an item from their shopping cart /// </summary> /// <param name="id">the unique id for this product such as SKU</param> /// <param name="name">the name of the product</param> /// <param name="categoryName">the category name that this product is assigned</param> /// <param name="rating">the numeric rating value that they provided</param> /// <returns></returns> // structure // function (id, name, categoryName, rating) _fxm.events.push(['_fxm.ecommerce.productreview', '<id>', '<name>', '<categoryName>', '<rating>']); </script>
Ecommerce Add Product to Shopping Cart
Send this event when a customer adds an item to their shopping cart.
<script type="text/javascript"> /// <summary> /// Sends an event when a customer adds an item to their shopping cart /// </summary> /// <param name="id">the unique id for this product such as SKU</param> /// <param name="name">the name of the product</param> /// <param name="categoryName">the category name that this product is assigned</param> /// <param name="quantity">the total quantity for this product</param> /// <param name="price">the price for a single unit</param> /// <returns></returns> // structure // (id, name, categoryName, quantity, price) _fxm.events.push(['_fxm.ecommerce.cartitem', '<id>', '<name>', '<categoryName>', '<quantity>', '<price>']); </script>
Ecommerce Purchase Item
Send this event when a customer purchases an item, an event should be sent for each item separately.
<script type="text/javascript"> /// <summary> /// Sends an event when a customer purchases an item /// </summary> /// <param name="id">the unique id for this product such as SKU</param> /// <param name="name">the name of the product</param> /// <param name="categoryName">the category name that this product is assigned</param> /// <param name="quantity">the total quantity for this product</param> /// <param name="price">the price for a single unit</param> /// <param name="orderId">the id of this order</param> /// <returns></returns> // structure // (id, name, categoryName, quantity, price, orderId) _fxm.events.push(['_fxm.ecommerce.purchaseitem', '<id>', '<name>', '<categoryName>', '<quantity>', '<price>', '<orderId>']); </script>
Ecommerce Order
Should be sent from your order confirmation page after order has been placed. This event provides the additional details that we need for any given order that wasn't received with the purchase item event.
<script type="text/javascript"> /// <summary> /// Sends an event when a customer purchases their cart /// </summary> /// <param name="id">the unique id for this order</param> /// <param name="subtotal">the sub total for this order</param> /// <param name="shippingTotal">the shipping total for this order</param> /// <param name="taxTotal">the tax total for this order</param> /// <param name="billingCity">the billing city name for this order</param> /// <param name="billingState">the billing state name for this order</param> /// <param name="billingZip">the billing zip code for this order</param> /// <param name="quantity">the total quantity/units in this order</param> /// <returns></returns> // structure // (id, subtotal, shippingTotal, taxTotal, billingCity, billingState, billingZip, quantity) _fxm.events.push(['_fxm.ecommerce.order', '<id>', '<subtotal>', '<shippingTotal>', '<taxTotal>', '<billingCity>', '<billingState>', '<billingZip>', '<quantity>']); </script>