Upgrade to Pro — share decks privately, control downloads, hide ads and more …

funneljoin: Defining a Tidy Grammar of Funnels in R

funneljoin: Defining a Tidy Grammar of Funnels in R

An introduction to the R package funneljoin, which makes it easy and fast to analyze series of events.

Emily Robinson

November 08, 2019
Tweet

More Decks by Emily Robinson

Other Decks in Programming

Transcript

  1. funneljoin: Defining a Tidy
    Grammar of Funnels in R
    Emily Robinson
    @robinson_es

    View full-size slide

  2. What is a funnel?
    A funnel is a set
    of events by
    users over time

    View full-size slide

  3. E-Commerce company redesigning the homepage
    ➔ Potential questions:
    ➔ What’s the last page people visit before coming to the homepage?
    ➔ What are all the product pages people see after the homepage?
    ➔ How many people who visit the homepage go on to buy something?
    ➔ What if we limit that to buy within two days?

    View full-size slide

  4. Some other “first this than that” questions
    ➔ Which salmon migrated to station 1 then station 3 before station 2?
    ➔ What drugs did people take in the last month before starting drug X?
    ➔ What was the last ad clicked before registering?
    ➔ What companies had their stock hit $100 per share then drop to $40?

    View full-size slide

  5. Example question
    ➔ When was each user’s first landing and their first registration afterward?

    View full-size slide

  6. Old workflow
    ➔ When was each user’s first landing and their first registration afterward?
    1. Filter landed for the first row
    per user
    2. Left join with registered on
    user_id
    3. Filter for timestamp.y >
    timestamp.x or NA
    4. Filter for first row of
    timestamp.y

    View full-size slide

  7. Old workflow
    ➔ Who registered the first time ever after their last landing?
    1. Filter landed for the last row
    per user
    2. Filter registered for first row
    per user
    3. Left join with registered on
    user_id
    4. Filter for timestamp.y >
    timestamp.x or NA

    View full-size slide

  8. Funneljoin package: github.com/robinsones/funneljoin

    View full-size slide

  9. Goals of this talk: you and funnels
    5 minutes ago After this talk Tomorrow

    View full-size slide

  10. Funneljoin Overview

    View full-size slide

  11. after_join()
    ➔ When was each user’s first landing and their first registration afterward?

    View full-size slide

  12. after_join()
    ➔ When was each user’s first landing and their first registration afterward?
    ➔ Table 1
    ➔ Table 2
    ➔ User column names(s)
    ➔ Time column name(s)
    ➔ Type of afterjoin

    View full-size slide

  13. after_join() structure
    ➔ When was each user’s first landing and their first registration afterward?
    ➔ Table 1
    ➔ Table 2
    ➔ User column names(s)
    ➔ Time column name(s)
    ➔ Type of afterjoin

    View full-size slide

  14. Different funnels
    Time
    Ad Click
    Conversion

    View full-size slide

  15. First ad click and first conversion afterwards?
    Time
    Ad Click
    Conversion

    View full-size slide

  16. First ad click and first conversion afterwards?
    Time
    Ad Click
    Conversion

    View full-size slide

  17. First ad click and first conversion afterwards?
    Time
    Ad Click
    Conversion

    View full-size slide

  18. First ad click and first conversion afterwards?
    Time
    first-firstafter
    Ad Click
    Conversion

    View full-size slide

  19. Most recent ad click and all conversions afterward?
    Time
    Ad Click
    Conversion

    View full-size slide

  20. Most recent ad click and all conversions afterward?
    Time
    Ad Click
    Conversion

    View full-size slide

  21. Most recent ad click and all conversions afterward?
    Time
    Ad Click
    Conversion

    View full-size slide

  22. Most recent ad click and all conversions afterward?
    Time
    last-any
    Ad Click
    Conversion

    View full-size slide

  23. All ad clicks and all the conversions afterward
    Time
    Ad Click
    Conversion

    View full-size slide

  24. All ad clicks and all the conversions afterward
    Time
    Ad Click
    Conversion

    View full-size slide

  25. All ad clicks and all the conversions afterward
    Time
    any-any
    Ad Click
    Conversion

    View full-size slide

  26. Different funnels
    Time
    first-firstafter
    any-any
    last-any
    Ad Click
    Conversion

    View full-size slide

  27. 16 types of funnels
    Table 1 type Table 2 type
    First (ever) First (ever)
    Last (ever) Last (ever)
    Any (all) Any (all)
    Lastbefore Firstafter
    Any combination of:

    View full-size slide

  28. Analyzing StackOverflow R questions
    https://www.kaggle.com/stackoverflow/rquestions/downloads/rquestions.zip/3

    View full-size slide

  29. How many people who ask a question later answer one?

    View full-size slide

  30. How long does it take for people to answer their first question?

    View full-size slide

  31. How long does it take for people to answer their first question?

    View full-size slide

  32. What percent answer within a week of asking their first question?

    View full-size slide

  33. Who answers a question before asking one?

    View full-size slide

  34. Funneljoin goals
    “Impossible” Possible

    View full-size slide

  35. Funneljoin goals
    Time-
    consuming &
    error-prone
    Quick &
    easy

    View full-size slide

  36. Funneljoin goals
    Limited
    Creativity
    Asking &
    answering
    new questions

    View full-size slide

  37. Learn more
    https://robinsones.github.io/funneljoin/
    https://hookedondata.org/introducing-the-
    funneljoin-package/

    View full-size slide

  38. Thank you!
    hookedondata.org
    @robinson_es
    github.com/robinsones/funneljoin
    Datascicareer.com

    View full-size slide