How Statsbot for Slack Can Integrate Analytics into Your Daily Routine

    by Alexandra Kanik
    April 21, 2016

    In order to adopt new habits into daily life, two things are usually needed: the thing you’re trying to adopt has to be useful to you, and you have to be able to more-or-less seamlessly incorporate it into your day to day. More often than not it’s the latter point, not the former, that stops us from exercising daily and sticking to our diets.

    The same holds true for things like trying to tweet throughout the day, or write a blog post every other day, or check your site’s analytics every day. We know we should be doing these things, and we might even do them consistently for the first few weeks, but after a while, our normal routine pushes these things out and we find ourselves waking up three months later wondering when we last checked in on our site’s sessions per visit.

    "In order to use Statsbot, you need to know what questions you want your Google Analytics data to answer."

    Slack, the popular messaging platform for journalists and non-journalists alike, now has a bot that will give you an overview of your site’s Google Analytics. You have the options of prompting Statsbot, as it’s so lovingly called, for your analytics, or you can schedule analytics to be sent to a channel of your choosing.


    I’m going to go through installing and setting up Statsbot in a way that allows me to seamlessly integrate a daily metrics analysis into my crazy life.

    Installing Statsbot

    Visit the Statsbot website and click “Add to Slack”.



    Choose which team you would like to integrate Statsbot into, or sign in to another team if your team isn’t listed. Note: If you want Statsbot to integrate with multiple teams, you can repeat these instructions for each team.

    Statsbot will ask you to confirm your identity. It will also let you know that it’s adding a user with the username @statsbot to your team. Click “Authorize” to confirm.

    Next, Statsbot will ask you to connect to the appropriate Google Analytics account for the team you’re configuring. Click “Connect Google Analytics”, then select the Google account that you’re trying to pull data from with Statsbot.

    Since you may have more than one Google Analytics profile attached to your Google Account, choose the profile you want Statsbot to pull data from. If you have your Google Analytics accounts set up with multiple views, you will be able to specify a view at this point. Click “Save.”

    You will likely not want to add a New Relic or a Mixpanel account, but if you have those things and would like to add them go for it! Note: this tutorial will not go into configuring those additional integrations.

    Now we can head on over to our Slack team and start using Statsbot!!

    Statsbot Basics

    Once you’re in your Slack team, click on the @statsbot direct message. You should have received a notification from @statsbot thanking you for adding it to your team and giving you some further directions on how to get started.


    One of the reasons I find Statsbot to be so wonderful has to do with the way it makes you query your metrics. In order to use Statsbot, you need to know what questions you want your Google Analytics data to answer. Do you want to know how many users you had yesterday? Do you want to know when your pageviews rise above 1,000? Statsbot is pretty configurable, but it will only be useful to you if you ask the right questions.

    If you ever become confused or don’t know what to do next with Statsbot, you can click on the @statsbot user under Direct Messages and type “help”. Statsbot will serve you up a list of commands that you can use to query your Google Analytics data.

    To use a command, simply type the command into a @statsbot direct message.

    Any commands that include carrotted text, like “alert <metric>” require you to replace the carrotted text with another word. These carrotted words are called “variables”. In the example above, “alert <metric>”, <metric> is a variable that we can replace with any number of Google Analytics metrics. For example, we could write “alert users” or “alert pageviews”.

    For a list of available metrics, type “list metrics” in the @statsbot direct message.

    Essential Queries

    Using Statsbot’s “help” command and their wonderful walk through when you first set it up, you’ll be able to explore what Statsbot has to offer pretty thoroughly. But here are some of the queries that I find to be essential for everyday use:

    For today:

    If you don’t specify a time period, @statsbot will serve you up metrics from today by default

    active users – this will tell you how many users are currently interacting with your site.
    users – this will tell you how many users you have had on your site today. It will also give you a look at last week’s users as a number (ex: 528), as a percent change (-54.14%) and in a lovely line chart so you can benchmark.
    users by page – this will break down you user count by the top 5 pages visited. The difference between “users” and “pageviews” is uniqueness. So querying “pagviews by page” will likely give you a larger number because one user may have visited a single page multiple times during the given time period.
    users by landing page – this is similar to the above query, but it will give you a better idea of which pages your users are finding your site by.
    users by source / medium – this will tell you where users were directly before entering your site, or what sources are referring people to your site.

    For yesterday:

    pageviews yesterday
    users by page yesterday
    users by landing page yesterday

    For this week/last week:

    users by page <last week>
    avg session duration <last week>


    For this month/last month:

    pageviews <last month>
    users <last month>
    sessions per user <last month>
    new users <last month>
    bounce rate <last month>


    You’ll want to get an idea of where these metrics generally stand first. Then you can set alerts for when those norms are exceeded.

    alert active users
    alert pageviews
    alert users


    *Bonus* You can export the charts that Statsbot creates for use in reports, newsletter updates, etc.

    Scheduling StatBot

    Using Statsbot to query Google Analytics whenever you want is super helpful. However, this type of manual querying doesn’t necessarily help us incorporate a healthy dose of metrics into our daily or weekly routine. But never fear! Statsbot has that issue covered. Prefixing your Statsbot commands with the word “schedule” allows you to set that query as a scheduled report.

    For example, entering “schedule new users by source / medium” prompts @statsbot to schedule a report of new users by source / medium to be delivered to you either daily or weekly.

    Different StatBots for Different Channels

    Statsbot is extremely useful as a personal tool, but it’s also a great way to share metrics with your team. If you want to use Statsbot in a shared channel, first you must invite @statsbot to that channel by entering “/invite @statsbot” in the channel discussion form. Statsbot can then be used in much the same way you use it via direct message, you just need to add @statsbot to the beginning of the query you pass it. For example:

    Direct message query:
    “alert pageviews”

    Channel query:
    “@statsbot alert pageviews”

    Scheduled Statsbot reports will appear in the channel in which they are scheduled. For example, if you enter “schedule new users” in the @statsbot direct message channel, it will deliver the new users report to that direct message channel. If you enter “@statsbot schedule new users” in a shared team channel, the scheduled report will appear in that channel.

    There are many, many ways to query your Google Analytics data using Statsbot. The things I’ve illustrated above are meant to introduce you to the joy that is Statsbot and give you a solid starting point. You should, as always, ask yourself what your organization’s goals are and then create Statsbot reports that are geared toward assessing the health of those goals.

    Alexandra Kanik (@act_rational) is the Metrics Editor/Curator for MediaShift. In addition to her work with MediaShift, Alexandra is a freelance developer for news organizations around the country.

    Tagged: analytics automation bots google analytics reports scheduling slack

    Comments are closed.

  • MediaShift received funding from the Bay Area Video Coalition (BAVC), which receives support from the Bill & Melinda Gates Foundation, to launch the MetricShift section to create a vibrant hub for those interested in media metrics, analytics and measuring deeper impact.

    About MetricShift

    MetricShift examines the ways we can use meaningful metrics in the digital age. We provide thoughtful, actionable content on metrics, analytics and measuring impact through original reporting, aggregation, and audience engagement and community.

    Executive Editor: Mark Glaser

    Metrics Editor: Jason Alcorn

    Reader Advisory Board

    Chair: Anika Anand, The Evergrey

    Brian Boyer, Spirited Media

    Clare Carr, Parse.ly

    Anjanette Delgado, Gannett

    Hannah Eaves, consultant, Gates Foundation

    Alexandra Kanik, Ohio Valley Resource

    Ian Gibbs, Data Stories

    Lindsay Green-Barber, The Impact Architects

    Celeste LeCompte, ProPublica

    Alisa Miller, PRI

    Connect with MetricShift

    Facebook group: Metrics & Impact

    Twitter: #MetricShift

    Email: jason [at] jasalc [dot] com

  • Who We Are

    MediaShift is the premier destination for insight and analysis at the intersection of media and technology. The MediaShift network includes MediaShift, EducationShift, MetricShift and Idea Lab, as well as workshops and weekend hackathons, email newsletters, a weekly podcast and a series of DigitalEd online trainings.

    About MediaShift »
    Contact us »
    Sponsor MediaShift »
    MediaShift Newsletters »

    Follow us on Social Media