Skip to content

A bot integration for Vietcetera's Slack that pulls real-time data from Google Analytics Core Reporting API.

Notifications You must be signed in to change notification settings

dinhkellie/vietetc-slackbot

Repository files navigation

Vietcetera Analytics Bot

A bot integration for Vietcetera's Slack that pulls real-time data from Google Analytics Core Reporting API.

Important Note: The Slack Bot is hosted on Heroku's Free Tier so if the bot is not responding, the heroku dyno might need to be restarted.

On the command line:

heroku ps:scale worker=0

heroku ps:scale web=0

This shuts down all processes

heroku ps:scale worker=1

This turns the worker dyno back on

To verify the build status:

heroku logs --tail

And hopefully it says something like: app[api]: Build succeeded app[worker.1]: Starter Bot connected and running!

Usage:

@stats-bot help

Get various data points

Format @stats-bot count (metric) [optional] from (starttime) to (endtime)

Examples: @stats-bot count newUsers from 14daysago to today @stats-bot count pageviews from 100daysago to today @stats-bot count users

Get number of views on a specific article by time period

Format @stats-bot views (url slug - everything after vietcetera.com) [optional] from (starttime) to (enddtime)

@stats-bot views /en/yellow-fever-in-modern-day-vietnam-when-asia-is-like-disneyland/ from 3daysago to today

if (starttime) and (endtime) are left out, the default range will be past 7 days

Graph data points

Format @stats-bot graph (metric) [optional] from (starttime) to (enddtime)

@stats-bot graph users by day from 14daysago to today

See progress on goals

If you have a goal number in mind, say 1 million page views by the end of the month, there is a command to easily help you find out how close we are to that goal number.

@stats-bot goal 1000000 pageviews from 30daysago to today @stats-bot goal 1000000 pageviews mtd

Currently at 163688 pageviews which is 16.3688% of goal.

The output will be of the format: Currently at X (metric) which is Y % of goal.

Important:

  • Numbers must be without commas or periods i.e. 100,000 or 100.000 will not work.

Available metrics:

User

  • users - Total number of users (unique IDs/computers) who have initiated at least one session during the date range across all pages
  • newUsers - Number of first-time users across all pages
  • percentNewUsers - (newUsers / sessions)
  • 1dayUsers
  • 7dayUsers
  • 28dayUsers
  • 30dayUsers

Sessions

  • sessions - Total number of Sessions within the date range. A session is the period time a user is actively engaged with your website, app, etc.
  • sessionsPerUser
  • bounces - Number of visits that ended in only one pageview
  • bounceRate - bounces / sessions
  • sessionDuration
  • avgSessionDuration - The average length of a Session.

Traffic

  • organicSearches

Goal Conversions

  • goal1Starts
  • goalStartsAll
  • goal1Completions
  • goalCompletionsAll
  • goal1Value
  • goalValueAll
  • goalValuePerSession
  • goal1ConversionRate
  • goalConversionRateAll
  • goal1Abandons
  • goalAbandonsAll
  • goal1AbandonsRate
  • goalAbandonRateAll

Page Tracking

  • entrances
  • entranceRate
  • pageViews
  • pageViewsPerSession - Pages/Session (Average Page Depth) is the average number of pages viewed during a session. Repeated views of a single page are counted.
  • avgTimeOnPage
  • exits
  • exitRate

Site Speed

  • pageLoadTime
  • avgPageLoadTime
  • pageDownloadTime
  • serverConnectionTime

App Tracking

  • screenViews
  • screenViewsPerSession
  • timeOnScreen
  • avgScreenviewDuration

There are more metrics that you can use to get data - the full list is at: https://ga-dev-tools.appspot.com/query-explorer/ and https://developers.google.com/analytics/devguides/reporting/core/dimsmets

About

A bot integration for Vietcetera's Slack that pulls real-time data from Google Analytics Core Reporting API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages