-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
236 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@mbinjamil/matomo-client | ||
|
||
## Installation | ||
|
||
``` | ||
npm install @mbinjamil/matomo-client | ||
``` | ||
|
||
## Features | ||
|
||
- Injecting and loading Matomo script asynchronously | ||
|
||
## Usage | ||
|
||
Load script on mount and call tracking functions anywhere in the app | ||
|
||
### [API Reference](docs/README.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# @mbinjamil/matomo-client | ||
|
||
- [load](functions/load.md) | ||
- [push](functions/push.md) | ||
- [trackEvent](functions/trackEvent.md) | ||
- [trackPageView](functions/trackPageView.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[@mbinjamil/matomo-client](../README.md) / load | ||
|
||
# Function: load() | ||
|
||
> **load**(`trackerUrl`, `siteId`): `void` | ||
Injects the Matomo tracking script into the DOM and loads it asynchronously | ||
|
||
## Parameters | ||
|
||
• **trackerUrl**: `string` | ||
|
||
Your Matomo URL | ||
|
||
• **siteId**: `number` | ||
|
||
Site ID of the website you are tracking in Matomo | ||
|
||
## Returns | ||
|
||
`void` | ||
|
||
## Source | ||
|
||
[index.ts:13](https://github.com/binjamil/matomo-client/blob/ffe9db3ab8b729a706d4a5e6374173837f833606/src/index.ts#L13) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[@mbinjamil/matomo-client](../README.md) / push | ||
|
||
# Function: push() | ||
|
||
> **push**(`values`): `void` | ||
Low-level Matomo API to execute any supported configuration or tracking calls | ||
|
||
## Parameters | ||
|
||
• **values**: readonly (`string` \| `number`)[] | ||
|
||
An array defining API method name and its parameters | ||
|
||
## Returns | ||
|
||
`void` | ||
|
||
## See | ||
|
||
https://developer.matomo.org/api-reference/tracking-javascript | ||
|
||
## Example | ||
|
||
```ts | ||
push([ 'API_method_name', parameter_list ]); | ||
``` | ||
|
||
## Source | ||
|
||
[index.ts:71](https://github.com/binjamil/matomo-client/blob/ffe9db3ab8b729a706d4a5e6374173837f833606/src/index.ts#L71) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[@mbinjamil/matomo-client](../README.md) / trackEvent | ||
|
||
# Function: trackEvent() | ||
|
||
> **trackEvent**(`category`, `action`, `name`, `value`): `void` | ||
Logs an event of interest | ||
|
||
## Parameters | ||
|
||
• **category**: `string` | ||
|
||
An event category (Videos, Music, Games...) | ||
|
||
• **action**: `string` | ||
|
||
An event action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...) | ||
|
||
• **name**: `string` | ||
|
||
An optional event name | ||
|
||
• **value**: `number` | ||
|
||
An optional numeric value | ||
|
||
## Returns | ||
|
||
`void` | ||
|
||
## Source | ||
|
||
[index.ts:53](https://github.com/binjamil/matomo-client/blob/ffe9db3ab8b729a706d4a5e6374173837f833606/src/index.ts#L53) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[@mbinjamil/matomo-client](../README.md) / trackPageView | ||
|
||
# Function: trackPageView() | ||
|
||
> **trackPageView**(`pageTitle`?): `void` | ||
Logs a page view. The URL is set to `window.location.href` because Matomo | ||
by default does not support client-side routing | ||
|
||
## Parameters | ||
|
||
• **pageTitle?**: `string` | ||
|
||
A custom title that overrides the default HTML page title | ||
|
||
## Returns | ||
|
||
`void` | ||
|
||
## Source | ||
|
||
[index.ts:40](https://github.com/binjamil/matomo-client/blob/ffe9db3ab8b729a706d4a5e6374173837f833606/src/index.ts#L40) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugin": ["typedoc-plugin-markdown"], | ||
"hidePageHeader": true, | ||
"excludeGroups": true, | ||
"out": "./docs" | ||
} |