With Mouseflow, you can associate additional information with a session by using custom variables or tags.
A tag allows you to push a single string into Mouseflow - one piece of information like popup_fired
or order_placed
. In addition, there are some tags that are already set up for you.
Use
Tags and Variables allow you to sort/filter various tools in Mouseflow based on your own data to isolate a broad segment of visitors.
Use cases
Here is a list of some of items you might want to track:
- Order Amount/Value
- Campaign ID
- Error Codes
- Search Terms
- Events (e.g. Modal Clicked, Abandoned Cart, Up-sell/Cross-sell)
Setup
Setting up tags on your site is relatively easy but it does require a small amount of coding.
Note: If you're using Google Tag Manager please see our article on setting up tags in GTM.
Adding a Single Tag Using the Tracking Code
To push a tag, add the following line to your tracking code.
window._mfq.push(["tag","my-tag"]);
Set the "my-tag" part to match your requirements, accordingly.
Here's an example:
<script type="text/javascript">
window._mfq = window._mfq || [];
(function() {
var mf = document.createElement("script");
mf.type = "text/javascript"; mf.defer = true;
mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
document.getElementsByTagName("head")[0].appendChild(mf);
})();
window._mfq.push(["tag","my-tag"]);
</script>
Adding Multiple Tags Using the Tracking Code
To push multiple tags, just add additional lines. Set the "my-tag" part to match your requirements, accordingly.
Here's an example:
<script type="text/javascript">
window._mfq = window._mfq || [];
(function() {
var mf = document.createElement("script");
mf.type = "text/javascript"; mf.defer = true;
mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
document.getElementsByTagName("head")[0].appendChild(mf);
})();
window._mfq.push(["tag","my-tag"]);
window._mfq.push(["tag","my-other-tag"]);
</script>
Adding a Tag Separate from the Tracking Code
If you want to add a tag without changing your tracking code, you'll just need to enter a short snippet of code. This may come in handy if you are using Google Tag Manager or another extension.
Here's an example:
<script type="text/javascript">
window._mfq = window._mfq || [];
window._mfq.push(["tag","my-tag"]);
</script>
Notes
- The URL on the "mf.src" line must be customized to match the tracking code in your account. In particular, "your-website-id.js" should be replaced with the unique ID for your website.
- You should always test this to make sure it has the desired functionality.