An example app using the Ampli Python Wrapper in Django project
You will need to do the following before running the app.
pip install -r requirements.txt
cp ampli_app/.env.example ampli_app/.env
You can run the app using the events from our sample tracking plan. This will start a test server http://127.0.0.1:8000/.
python manage.py runserver
In your browser
- Open http://127.0.0.1:8000/amplitude/identify?user_id=example_user&required_number=15.1&optional_array=a,b,c to send identify event.
- Open http://127.0.0.1:8000/amplitude/groupidentify?group_type=team&group_name=SDE&required_boolean=false to send a group identify event.
- Open http://127.0.0.1:8000/amplitude/setgroup?user_id=example_user&group_type=team&group_name=SDE to put example_user into SDE team.
- Open http://127.0.0.1:8000/amplitude/eventnoproperties?user_id=example_user to track an EventNoProperties event.
- Open http://127.0.0.1:8000/amplitude/eventwithconsttypes?user_id=example_user to track a EventWithConstTypes event.
- Open http://127.0.0.1:8000/amplitude/eventwithallproperties to track a EventWithAllProperties event.
- Open http://127.0.0.1:8000/amplitude/flush to flush events in buffer
If you want to use your own tracking plan and Ampli Wrapper
npm i -g @amplitude/ampli
- In ampli_app folder run
ampli pull
- Edit .env file add your API key
- Update
ampli_app/views.py
andampli_app/urls.py
to use the events from your tracking plan
- README.md - you are here *
- v1/
- urls.py - Url mapping for v1 project
- settings.py - Project setting
- ampli_app
- ampli
- ampli.py - Generated SDK, don't modify by hand. Update with
ampli pull
- requirements.txt - Dependencies of ampli wrapper
- ampli.py - Generated SDK, don't modify by hand. Update with
- views.py - Views of ampli app contains examples using Ampli wrapper. A good place to start.
- urls.py - Url mappings for views of app
- util.py - function to read api_key from .env file
- plugins.py - Example plugin for Event enrichment
- ampli