Amplitude API

Amplitude is growing in popularity for better product analytics and event data. This tutorial shows how to connect your amplitude data to your Quadratic spreadsheets.

import requests
import pandas as pd
import base64

# URL of Amplitude API endpoint
url = 'https://amplitude.com/api/3/chart/{chart-name}/query'
api_key = ""
secret_key = ""
key = api_key + ":" + secret_key
base64_key = base64.b64encode(key.encode()).decode()

# headers (these typically include your API key and/or other access tokens)
headers = {
  'Authorization': 'Basic {}'.format(base64_key),
  'Content-Type': 'application/json',
  'x-cors-api-key': ''
}

# Make the request
response = requests.get(url, headers=headers)

data = response.json()

date = data["data"]['series'][0]  # this is the list inside the 'series' part
values = data["data"]['xValues']

# create dataframe
df = pd.DataFrame()
df['Date'] = values
df['Seconds in App'] = date

df

Need help making this connection? Feel free to reach out to support@quadratichq.com for help.

Quadratic logo

The infinite canvas spreadsheet with code.

Try it now