Skip to content

Instantly share code, notes, and snippets.

@mattm
mattm / recent-posts-explore.lookml
Created May 11, 2018 17:46
Recent Posts Explore LookML
explore: mp_events {
view_label: "Mixpanel"
label: "Mixpanel"
join: mp_new_blog_content {
view_label: "Mixpanel"
type: left_outer
relationship: many_to_one
sql_on: ${mp_new_blog_content.current_url} = ${mp_events.current_url} ;;
}
@mattm
mattm / three-step-funnel-counts.sql
Created April 12, 2018 19:51
Three Step Funnel Count
SELECT
COUNT(viewed_pricing_at) AS viewed_pricing,
COUNT(viewed_sign_up_at) AS viewed_sign_up,
COUNT(signed_up_at) AS signed_up
FROM (
SELECT
pricing.distinct_id,
MIN(viewed_pricing_at) AS viewed_pricing_at,
MIN(viewed_sign_up_at) AS viewed_sign_up_at,
MIN(signed_up_at) AS signed_up_at
@mattm
mattm / funnel-first-events.sql
Created April 12, 2018 19:48
Three Step Funnel v2
SELECT
pricing.distinct_id,
MIN(viewed_pricing_at) AS viewed_pricing_at,
MIN(viewed_sign_up_at) AS viewed_sign_up_at,
MIN(signed_up_at) AS signed_up_at
FROM (
SELECT
distinct_id,
time AS viewed_pricing_at
FROM mp.event
@mattm
mattm / three-steps.sql
Created April 12, 2018 19:44
Three Step Funnel
SELECT
pricing.distinct_id,
viewed_pricing_at,
viewed_sign_up_at,
signed_up_at
FROM (
SELECT
distinct_id,
time AS viewed_pricing_at
FROM mp.event
@mattm
mattm / two-step-funnel.sql
Last active April 12, 2018 19:44
Two Step SQL Funnel
SELECT
pricing.distinct_id,
viewed_pricing_at,
viewed_sign_up_at
FROM (
SELECT
distinct_id,
time AS viewed_pricing_at
FROM mp.event
WHERE
@mattm
mattm / pricing-page.sql
Created April 12, 2018 19:34
Viewed Pricing Page
SELECT
distinct_id,
time AS viewed_pricing_at
FROM mp.event
WHERE
name = "Viewed Page" AND
current_url LIKE "https://www.helpscout.net/pricing/%"
+----------------------------------------------------+--------------------------------+
| distinct_id | viewed_pricing_at |
@mattm
mattm / jql-response.json
Created April 9, 2018 15:11
JQL Response
[
{
"dataset": "$mixpanel",
"distinct_id": "162a9bea91d1cb-01213631147e12-3f636c4c-1aeaa0-162a9bea91e8cf",
"labels": [],
"name": "Signed Up",
"properties": {
"$browser": "Safari",
"$browser_version": 11.1,
"$city": "Verrieres-le-Buisson",
@mattm
mattm / testing.js
Created April 9, 2018 15:07
Mixpanel JQL Example
function main() {
return Events({
from_date: '2018-04-09',
to_date: '2018-04-09',
event_selectors: [{event: 'Signed Up'}]
});
}
@mattm
mattm / mp.lookml
Created April 6, 2018 18:27
Mixpanel Looker Model
connection: "bigquery"
include: "*.view.lkml"
explore: mp_events {
view_label: "Mixpanel"
label: "Mixpanel"
sql_always_where: STRPOS(${full_url}, "https://www.helpscout.net") = 1 OR STRPOS(${full_url}, "https://secure.helpscout.net") = 1 ;;
@mattm
mattm / mp_events.lookml
Created April 6, 2018 18:25
Looker Mixpanel Events
view: mp_events {
sql_table_name: mp.event ;;
dimension: event_id {
primary_key: yes
type: number
sql: ${TABLE}.event_id ;;
}
dimension: browser {