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
If you have your own in-house tracker or a wrapper function that calls other tracking libraries, you can specify the function signature with the `-c` or `--customFunction` option.
41
41
42
+
#### Standard Custom Function Format
43
+
42
44
Your function signature should be in the following format:
If your function follows the standard format `yourCustomTrackFunctionName(EVENT_NAME, PROPERTIES)`, you can simply pass in `yourCustomTrackFunctionName` to `--customFunction` as a shorthand.
59
61
62
+
#### Method-Name-as-Event Format
63
+
64
+
For tracking patterns where the method name itself is the event name (e.g., `yourClass.yourEventName({...})`), use the special `EVENT_NAME` placeholder in the method position:
65
+
66
+
```js
67
+
yourClass.EVENT_NAME(PROPERTIES)
68
+
```
69
+
70
+
This pattern tells the analyzer that:
71
+
-`yourClass` is the object name to match
72
+
- The method name after the dot (e.g., `viewItemList`, `addToCart`) is the event name
73
+
-`PROPERTIES` is the properties object (defaults to the first argument if not specified)
- Event: `viewItemList` with properties from the first argument
88
+
- Event: `addToCart` with properties from the first argument
89
+
- Event: `purchase` with properties from the first argument
90
+
91
+
_**Note:** This pattern is currently only supported for JavaScript and TypeScript code._
92
+
93
+
#### Multiple Custom Functions
94
+
60
95
You can also pass in multiple custom function signatures by passing in the `--customFunction` option multiple times or by passing in a space-separated list of function signatures.
0 commit comments