Skip to content

Instantly share code, notes, and snippets.

-- DAILY
SELECT DATE_TRUNC('day', sent_at) AS day,
COUNT(DISTINCT user_id) AS users, -- These are people who are logged in
COUNT(DISTINCT anonymous_id) AS visitors -- These are all visitors, including those who might be logged out
FROM segment.tracks
GROUP BY 1
ORDER BY 1
-- WEEKLY
import requests
import pandas as pd
from bs4 import BeautifulSoup
def get_details(grant):
details = grant.findAll("div")
amount = details[0].text.strip()
year = details[1].text.strip()