Skip to content

Instantly share code, notes, and snippets.

@malterb
Created September 1, 2020 12:43
Show Gist options
  • Save malterb/92a481a184ec6afc56f7189bb4d97ff3 to your computer and use it in GitHub Desktop.
Save malterb/92a481a184ec6afc56f7189bb4d97ff3 to your computer and use it in GitHub Desktop.
Export Amplitude data per day
# this script will loop through every day between the two dates and download the amplitude data to a zip file named after the day
# the script will actually duplicate the 00 data, but running unzip -o will take care of it by overwriting
d=2018-01-01
while [ "$d" != 2020-09-02 ]; do
formatted=$(date -d $d "+%Y%m%d")
echo "getting ${formatted}"
d=$(date -I -d "$d + 1 day")
formatted_new=$(date -d $d "+%Y%m%d")
curl -u API_Key:Secret_Key "https://amplitude.com/api/2/export?start=${formatted}T00&end=${formatted_new}T00" >> ${formatted}.zip
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment