Knowledge base | mouseflow

Google Analytics Integration

Mouseflow integrates seamlessly into the world's most popular analytics software, Google Analytics. Mouseflow and Google Analytics are a perfect fit for getting the high-level overview of the numbers and the qualitative drill-down of actual user behavior. Here's how to integrate:

  1. Login to Universal Analytics and create a custom dimension (link). The name should be "MFSID", the scope should be "User", and the "Active" box should be checked. On the right of the page (in the "Example" section), there will be code that looks like ga('set', 'dimensionX', dimensionValue). You'll want to take note of the dimension name that is listed (dimensionX in this example) for the next step.

  2. On the website, you'll want to have the Mouseflow the tracking code installed and then add the following snippet below it (be sure to customize the code with your Universal Analytics Property ID which is found under "Admin" > "Property Settings" and the correct dimension name from step #1):

     <script type="text/javascript">
      function whenThen(conditionFunc, intervalInMs, successFunc) {
        var rounds = 0;
        var timer = setInterval(function() {
          if (conditionFunc()) {
          if (rounds > 3) {
        }, intervalInMs);
      function googleAnalyticsIntegration() {
        ga('create', 'UA-XXXXXXX-X');
        ga('set', 'dimensionX', mouseflow.getSessionId());
        ga('send', 'event', 'Mouseflow', mouseflow.getSessionId(), {'nonInteraction': 1});
    whenThen(function() { return && window.mouseflow; }, 1000, function() { googleAnalyticsIntegration(); });
  3. To verify it's working, download the Google Analytics Debugger browser plugin and check your console output. You should see the correct dimensionX variable being set.

  4. After ~24 hours of collecting data, login to Universal Analytics, navigate to Behavior > Events > Pages, click Secondary Dimension (dropdown) > Custom Dimensions, and pick the custom dimension you just setup.

  5. This will display a custom report which shows a list of visitor data, including the Mouseflow Session ID tied to their activity. Then copy or export the resulting list of session IDs, login to Mouseflow, click "Recordings", click "Filter" (small funnel icon in top-right), and under "Filters", select "Session IDs" paste the list of session IDs you just copied/exported (one per line). Finally, click "Search" to see the filtered list of recordings.