Giter Site home page Giter Site logo

ahoy_guide's Introduction

Ahoy

🔥 A foundation of knowledge and libraries for solid analytics

Best practices for:

  • tracking visits, events, emails, and referrals
  • scaling storage
  • funnels, cohorts, and LTV calculations
  • experiments like split tests
  • and much more

Designed to work with any progamming language and any device.

Never build an analytics platform from scratch again.

This is a work in progress, built for the open-source community. If you have great practices, articles, or videos, please share.

⚠️ Everything below is scattered and probably makes no sense

Outline

  • Intro
  • The Perfect Platform
  • People
  • Qualitative Feedback
  • Funnels
  • Split Tests
  • Web
    • Landing page
      • Acquisition
      • Funnels
      • Experiments
    • Product
      • Same as above
  • iOS
    • Same as above
  • Android
    • Same as above
  • Emails
  • Referrals
  • Load Times
  • Storage
  • Privacy
  • HTTP Spec

Entities

Visitor

Visitors have properties

Visit (session)

A visit belongs to a visitor. Users can have visits through authentication events.

A visit provides:

  • a way to attach events that happened before sign in
  • how someone arrived at the website or app
  • a rough idea of location for local services
  • information about the technology (browser, screen size, OS version), which you can use this to tailor your product to users

Event

Events are actions a person performs.

Events have a visit (from which you can get the visitor) possibly a user.

User

Users are authenticated visitors

Users have properties

Technical Notes

References to “unique id” in this guide refer to a UUID. These should be stored as a 128-bit number, not a string (except for logs).

Visitors and visits should be given a unique id on the server for web apps and stored in cookies.

People

Two users viewing a page is different than one user viewing it twice. This is critical for funnels and experiments.

There are two type of people:

  • Users - authenticated
  • Visitors - anonymous

Qualitative Feedback

Funnels

Intent is key

Segment by:

  • mobile vs desktop
  • channel
  • experiment

Split Tests

Commonly called split tests or A/B tests

Start with big changes (exploration), not button colors

Use same tracking as events for conversions

Segment key funnels by experiment variation

Split tests are special properties attached to visitors or users.

Variation membership should be stored. They should be looked up by user id (first), then visitor id.

If there is a user but only a split test variation for the visitor, the user should use the same variation.

It should be easy for developers to test variations.

Web

Visits

There are two ways to tell where a visitor has come from:

  • the Referer header
  • query parameters, like utm_source

When a user clicks on a link, most browsers set the Referer header with the URL of the previous page. From this, you can extract:

TODO: Explain how different browsers handle redirects and note about HTTPS -> HTTP

There are a few things you can calculate about the visitor:

  • estimated location from IP address
  • browser, OS, and device model from user agent

Client libraries have access to more information, like:

  • screen size
  • pixel density (retina) - does this really matter?

Be sure to exclude bots from your metrics - some like Googlebot run JavaScript.

Landing Page

The landing page is one of the most important pages of your website.

When an unauthenticated visitor lands on your site, there are a few things that could happen:

  • register (success!)
  • sign in
  • bounce

TODO: Note about multiple authentication strategies (email, Facebook, Google, etc)

Best practice: For third-party services, ask for the miminum number of permissions needed

Authenticated Visitors

If a visitor is authenticated, do not show them the landing page with a “Customer Login” link. Drop them right into your product.

Best practice: Keep users signed in between visits - unless you run a banking website of course

iOS

Android

Storage

Start simple and scale as needed - “premature optimization is the root of all evil”

  • logs (not queryable)
    • backup to [S3]
  • database
    • PostgreSQL, Redis, Logstash, Fluentd
  • distributed data stores
    • Hadoop, Cassandra, [Amazon Redshift]

[not open source]

TODO: Recommendations for starting, scaling, and scaling again

Email

Give each message a unique id.

  • Track opens and clicks
  • One-click unsubscribe - don't make users confirm or sign in
  • Give the option to resubscribe or manage other lists
  • Use your own unsubscribe link rather than rely on your email server

TODO: What emails to send, when to send them

Experiment with the message, time of day, triggers

Referrals

How to track referrals correctly

Load Times

Latency matters

  • Amazon - every 100ms cost them 1% in sales
  • Google - an extra half second dropped search traffic by 20%

No one ever wants a slow service

How to instrument load times: Give each request a unique id and record the time the:

  • request starts
  • server completes request
  • JavaScript says ready

Tricks:

  • Limit redirects

Acceptable tresholds

Better SEO?

Privacy

Things not to do

Section on Do Not Track

HTTP Spec

Visits

A POST request is sent with:

  • visit_token
  • visitor_token
  • referrer
  • landing_page

The server can capture:

  • ip
  • user_agent
  • user - from app authentication

And calculate things like:

  • referring_domain and search_keyword from referrer
  • utm_source, utm_medium, utm_term, utm_content, and utm_campaign from landing_page
  • city, region, and country from ip
  • browser, os, and device_type from user_agent

Events

A POST request is sent with:

  • name
  • properties
  • time

The server can capture:

  • visit_token - from cookies
  • user - from app authentication

As a precaution, the server should reject times that do not match:

1 minute ago < time <= now

Libraries

Client Tracking

Works with any backend

Server Tracking + Backend

  • Ruby
  • Others (help make this possible)

Email

  • Ruby
  • Others (help make this possible)

Experiments, Funnels, Cohorts, More

  • Coming soon

Great Content

ahoy_guide's People

Contributors

ankane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ahoy_guide's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.