dcsan / gitterbot

GitterBot / gitter chatbot with Wiki integration, and more!
https://gitter.im/dcsan/gitterbot
61 stars 83 forks source link

GA tracking #169

Open dcsan opened 9 years ago

dcsan commented 9 years ago

add tracking on GA for the app https://www.npmjs.com/package/universal-analytics

basic tracking with events per room would be great we could add more granular control later...

we could in fact track every message since we are listening to it all so this is not just the bot but would be general traffic stats for the chat.

evaristoc commented 9 years ago

look at GA integration I asked at gitterHQ/developers... I also asked for any special policy they have about using GA over their pages... my guess is that someone at FCC could receive some kind of access to special data as room owner (I have seen that happening in other places)

evaristoc commented 9 years ago

This is the answer from someone at gitterHQ/developers:

they are your rooms, if you want to track your user behaviour, you are welcome to, although you might need some terms and conditions when people join your room from a legal perspective. and you certainly wouldn't be able to use GA, you'd don't have access to our pages, so you'd have to do it via camperbot or such.

it's a feature we're looking to add next year, some basic community analytics.

dcsan commented 9 years ago

something like this


class Metrics {

    // constructor(public fn:string) {}

    static track(input:Input, category:string="_category", action:string="_action") {

        var userId = input.from.id;
        var evt:IEvent = {
            ec: category,
            ea: action,
            ev: input.chat.id,
            el: input.text
        }
        var visitor = ua(AppConfig.GA_KEY, userId, {strictCidFormat: false});
        visitor.event(evt).send();
    }

}

export = Metrics;

this is typescript code from another project but you get the idea

dcsan commented 9 years ago

so this would be added whenever the bot receives a message event, but preferably after the event has been parsed so we can add any commands to the we want to track