matomo-org / matomo-org/matomo-nodejs-tracker
Add support for new Crash Analytics feature
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 117
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
To support Matomo's new [Crash Analytics](https://matomo.org/blog/2023/08/crash-analytics/) feature, we'd like to add crash tracking methods in all supported tracking SDKs.
The tracking methods should be similar to the PHP SDK's methods:
```
public function trackPhpThrowable(\Throwable $ex, $category = false); // deduces as much information as possible
public function trackCrash($message, $type, $category, $stack, $location, $line, $column); // user supplies all information
```
`trackCrash()` passes its parameters as the following HTTP API parameters:
* `$message`: sent as `cra`, the crash message
* `$type`: sent as `cra_tp`, the type of crash, for example "TypeError"
* `$category`: sent as `cra_ct` (optional, it's like a custom dimension to categorise the crash, typically left empty)
* `$stack`: sent as `cra_st`, a stack trace or similar
* `$location`: (the originating source file) sent as `cra_ru`, the file name or source or something similar
* `$line`: sent as `cra_rl`, the line number in the file
* `$column`: sent as `cra_rc`, the column within the line of the file
**IMPORTANT** It must also pass `ca=1` (stands for 'custom action') as a parameter so if the plugin is deactivated in Matomo, nothing will be tracked.
`trackPhpThrowable` (or the equivalent method for the language of this SDK) should accept an exception object and deduce set the crash tracking parameters based on it. The type should be set to the exception class name or something similar.
See also the implementation in the PHP tracker:
* https://github.com/matomo-org/matomo-php-tracker/blob/master/MatomoTracker.php#L937-L966
* https://github.com/matomo-org/matomo-php-tracker/blob/master/MatomoTracker.php#L1323-L1347
Please let me know if there are any questions.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Node.js track methods and the code that builds HTTP API parameters, then compare its conventions with the referenced PHP tracker methods at MatomoTracker.php lines 937-966 and 1323-1347. Add explicit crash parameter handling and exception-based tracking, ensuring requests include ca=1; verify the resulting request parameters with the repository's existing checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100