Skip to content

Commit 52aeb65

Browse files
Updated README
1 parent 63e0208 commit 52aeb65

File tree

1 file changed

+41
-15
lines changed

1 file changed

+41
-15
lines changed

README.md

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Interakt Track Python
2+
SDK : [interakt-track-python](https://pypi.org/project/interakt-track-python/)
23

34
# Getting Started
45

@@ -19,23 +20,27 @@ The default initialization settings are production-ready and queue messages to b
1920

2021
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.
2122
```
22-
def on_error(error, data):
23+
def on_error(error, items):
2324
print("An error occurred:", error)
2425
25-
2626
track.debug = True
2727
track.on_error = on_error
28-
2928
```
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
3242
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.
3343

34-
Either of the two for user identification is required:
35-
36-
- **user_id**
37-
- **phone_number** with **country_code**
38-
3944
Example `identify` call:
4045
```
4146
track.identify(
@@ -47,15 +52,36 @@ track.identify(
4752
}
4853
)
4954
```
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`|
5062

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.
5373

5474
Example `event` call:
5575
```
5676
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}
6080
)
6181
```
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

Comments
 (0)