You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -19,23 +20,27 @@ The default initialization settings are production-ready and queue messages to b
19
20
20
21
In development you might want to enable some settings to make it easier to spot problems. Enabling `track.debug` will log debugging info to the Python logger. You can also add an `on_error` handler to specifically print out the response you’re seeing from our API.
21
22
```
22
-
def on_error(error, data):
23
+
def on_error(error, items):
23
24
print("An error occurred:", error)
24
25
25
-
26
26
track.debug = True
27
27
track.on_error = on_error
28
-
29
28
```
30
-
31
-
# Identify
29
+
### All Settings:
30
+
|Settings name|Type|Default value|Description|
31
+
|--|--|--|--|
32
+
|sync_mode|bool|False|When `True`, calls the track API **synchronously**. When `False`, calls the track APIs **asynchronously** using a Queue.|
33
+
|debug|bool|False|To turn on debug logging|
34
+
|timeout|int|10|Timout for track API calls|
35
+
|max_retries|int|3|Number of API retries in case API call fails due to some error|
36
+
|max_queue_size|int|10000|Max Queue size|
37
+
|on_error|function|None|Callback function which is called whenever an error occurs in **asynchronous** mode
38
+
39
+
40
+
# APIs
41
+
## Identify
32
42
The `identify` lets you tie a user to their actions and record traits about them. It includes a unique **User ID** or **Phone Number and Country Code** any optional traits you know about them.
33
43
34
-
Either of the two for user identification is required:
35
-
36
-
-**user_id**
37
-
-**phone_number** with **country_code**
38
-
39
44
Example `identify` call:
40
45
```
41
46
track.identify(
@@ -47,15 +52,36 @@ track.identify(
47
52
}
48
53
)
49
54
```
55
+
The `identify` call has the following fields:
56
+
|Field|Data type|Description|
57
+
|--|--|--|
58
+
|user_id|str or int|The ID for the user in your database.|
59
+
|country_code|str|country code for the phone_number (default value is "+91")|
60
+
|phone_number|str|phone_number without country_code (eg: "9876598765")|
61
+
|traits|dict|A dict of traits you know about the user. Things like: `email`, `name` or `age`|
50
62
51
-
# Event
52
-
`event` lets you record the actions your users perform. Every action triggers what we call an “event”, which can also have associated properties.
63
+
**NOTE:** Atleast of these two is required for user identification :
64
+
65
+
-**user_id**, OR
66
+
-**phone_number** with **country_code**
67
+
68
+
69
+
70
+
71
+
## Event
72
+
`event` track API lets you record the actions your users perform. Every action triggers what we call an “event”, which can also have associated properties.
53
73
54
74
Example `event` call:
55
75
```
56
76
track.event(
57
-
user_id="<USER_ID>",
58
-
event="Add to Cart",
59
-
traits={"amount": 200}
77
+
user_id="changu_mangu",
78
+
event="Product Added",
79
+
traits={"price": 200}
60
80
)
61
81
```
82
+
The `event` call has the following fields:
83
+
|Field|Data type|Description|
84
+
|--|--|--|
85
+
|user_id|str or int|The ID for the user in your database.|
86
+
|event|str|Name of the event you want to track, For eg: "Product Added".|
87
+
|traits|dict|dictionary of properties for the event. If the event was **Product Added**, it might have properties like `price` or `product_name`.|
0 commit comments