GithubHelp home page GithubHelp logo

effinamazing / segment_attribution Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 37 KB

Looker block for building multi-touch attribution reporting on top of Segment warehouse data

License: MIT License

LookML 100.00%

segment_attribution's Introduction

Block Setup

This block is designed to be used with Segment data collected through the client-side Javascript library, Analytics.js. After some quick setup you'll be able to attribute all conversions within a given lookback window using various out-of-the-box multi-touch attribution models, or your own custom model. You can also remove the lookback window completely to see all-time attribution for all conversions. The definition of which event counts as a conversion and which property counts as its value can be configured to point at any Segment event and event property.

  1. Enter your Segment schema name, site domain, conversion event, and conversion value into the manifest. Read the comments in that file for more detail about what to input there.
  2. Update the logic for bucketing Sessions into Channels in the derived table in the sessions view.
  3. Adjust the session timeout period in the derived table in the sessions view, the default is 30 minutes of inactivity to create a new session.
  4. Add your own custom attribution models to the conversion_attribution view, the default models include first-touch, last-touch, linear, time-decay, and 40-20-40 (models explained in detail below).
  5. Open the Attribution dashboard to see your data populated and adjust the queries, visuals, and filters as you see fit.

Notes about this block

This block is built for BigQuery but can be adjusted to work for other databases like Redshift, Snowflake, etc. The biggest change will be that other databases won't require de-duping in the conversion_event, pages, tracks, and identifies views. Also, you will need to adjust some of the functions used in the sessions, events, and conversion_attribution views.

This block is intentially kept simple, if you want more information about ID mapping, sessionization, or additional features like Funnels, check out the Event Analytics by Segment block.

Attribution Models

The models we have included in this block include first-touch, last-touch, linear, time-decay, and 40-20-40. The calculation of each is explained below. For all models, they are dependent on the lookback window, so if the lookback window is set to 30 days, we only look back 30 days before the conversion for sessions that will be counted in the attribution model. If that lookback window is removed, then all sessions before the conversion will be counted.

First-touch

The Channel of the first session within the attribution lookback window gets 100% credit for the conversion.

Last-touch

The Channel of the last session within the attribution lookback window gets 100% credit for the conversion. This is equivalent to saying the session where the conversion happened gets 100% of the credit.

Linear

Credit for the conversion is split evenly across all sessions that happened in the attribution lookback window. If there is only one session, it gets 100% credit, 2 sessions mean each get 50%, 4 means each gets 25%, etc.

Time Decay

We are using this equation to calculate time-decay value for each session:

y = 2-x/7

In the formula, x is the number of days until the conversion happens and y is the credit given to the session. Adding up all the y values for a conversion won't app up to 1 conversion so we need to add up all y values, then for each session we calculate credit by dividing time decay credit for a given session by the sum of all session credit, for a conversion with 3 sessions it'd look like this to calculate credit for session 2:

ysession 2 / (ysession 1 + ysession 2 + ysession 3)

40-20-40

The first session in the attribution lookback window gets 40% of the credit, the conversion session gets 40% of the credit and the remaining 20% credit gets divided across all other sessions. If there are 2 sessions, each get 50% credit.

You can see the screenshots of the explore and default dashboard in the Looker blocks directory.

segment_attribution's People

Contributors

lookering avatar swhitey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.