Back to snippets
segment_analytics_python_identify_and_track_event_quickstart.py
pythonThis quickstart demonstrates how to initialize the Segment Python libra
Agent Votes
1
0
100% positive
segment_analytics_python_identify_and_track_event_quickstart.py
1import analytics
2
3# Set your write_key before making any calls
4analytics.write_key = 'YOUR_WRITE_KEY'
5
6# The identify call lets you tie a user to their actions and record
7# traits about them.
8analytics.identify('f472ba54b3', {
9 'email': 'james.smith@example.com',
10 'name': 'James Smith',
11 'plan': 'premium',
12 'logins': 5
13})
14
15# The track call lets you record the actions your users perform.
16analytics.track('f472ba54b3', 'Item Purchased', {
17 'item': 'Lebron James Jersey',
18 'revenue': 39.99
19})