Swetrix/swetrix-js (swetrix)
### [`v3.3.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.3.0)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.2.1...v3.3.0)
- Using `fetch` API instead of `XMLHttpRequest` ([https://github.com/Swetrix/swetrix-js/issues/14](https://togithub.com/Swetrix/swetrix-js/issues/14))
- Returning a promise from `track` method
### [`v3.2.1`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.2.1)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.2.0...v3.2.1)
Changelog:
- Exporting internal interfaces.
- `pageview` function now adds `prev` parameter by default.
### [`v3.2.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.2.0)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.1.1...v3.2.0)
Changelog:
- Added `meta` to `IPageViewPayload` interface. Now you can supply metadata with your pageview events just like on custom events.
- Deprecated `trackPageview` function in favour of `pageview`.
### [`v3.1.1`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.1.1)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.1.0...v3.1.1)
Changelog:
- fix: `callback` in `trackErrors` function was not evoking properly
### [`v3.1.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.1.0)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.0.3...v3.1.0)
Changelog:
**1. Introducing Error tracking!** This release adds 2 new methods: [trackErrors](https://docs.swetrix.com/swetrix-js-reference#trackerrors) and [trackError](https://docs.swetrix.com/swetrix-js-reference#trackerror) which allow you to track client-side errors on your websites.
2\. Updated a few misc dependencies.
### [`v3.0.3`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.0.3)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.0.2...v3.0.3)
Changelog:
- Fix types for the v3.0.2 release.
For full v3 release notes see https://github.com/Swetrix/swetrix-js/releases/tag/v3.0.0
### [`v3.0.2`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.0.2)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.0.1...v3.0.2)
Changelog:
- `trackViews` callback - updated return type from `IPageViewPayload` to `Partial`
For full v3 release notes see https://github.com/Swetrix/swetrix-js/releases/tag/v3.0.0
### [`v3.0.1`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.0.1)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.0.0...v3.0.1)
Changelog:
- Fixed `IPageViewPayload` pg type
For full v3 release notes see https://github.com/Swetrix/swetrix-js/releases/tag/v3.0.0
### [`v3.0.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.0.0)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v2.4.0...v3.0.0)
#### Changelog:
- **\[BREAKING]** Removed the `noUserFlow`, `doNotAnonymise`, `ignore` and `noHeartbeat` parameters for the `trackViews` function.
- **\[BREAKING]** The `debug` parameter for the `init` function has been removed. Instead, `devMode` is introduced. The only difference between `debug` and `devMode` is that messages are no longer printed to the console.
- Introducing new `trackViews` optional parameter - `callback`. The callback is supposed to replace `ignore` parameter and give you more control over what data is tracked.
The callback accepts the following object as it's only parameter:
```typescript
interface IPageViewPayload {
lc: string | undefined
tz: string | undefined
ref: string | undefined
so: string | undefined
me: string | undefined
ca: string | undefined
pg: string
prev: string | null | undefined
}
```
The callback should return one of the following:
- `true` - to send the pageview event as-is.
- `false` - to prevent sending the payload.
- An IPageViewPayload-like `object` - the object should contain the edited fields that will be assigned to the payload. For example, if your `pg` has some sensitive information (like `/account/54345345`), you can replace it with `/account/redacted` and return it as a callback result to be sent to the API. **Note** that the Swetrix script will append the callback result to an already existing payload, so if you're only returning `pg` - all the other parameters will be sent as is, if you'd like to overwrite them - you'll need to explicitly return them in the callback object.
#### Migration guide:
No changes in Swetrix config are needed unless you've been using the `ignore` parameter in the `trackViews` function.
If you were using `ignore` parameter in past - you may need to replace it with the `callback` instead. Here's an example on how you can do that.
Before upgrading to that version of Swetrix, your setup may look like this:
```javascript
Swetrix.trackViews({
ignore: [
/^\/users\/(?!new$)[^/]+$/i,
/^\/share/i,
'some-other-page',
],
heartbeatOnBackground: true,
// any other parameters
})
```
After upgrading, you'll need to replace `ignore` with a `callback` and here's an example on how you can do that:
```javascript
const checkIgnore = (path, ignore = []) => {
for (let i = 0; i < ignore.length; ++i) {
if (ignore[i] === path) return true
if (ignore[i] instanceof RegExp && ignore[i].test(path)) return true
}
return false
}
const pathsToIgnore = [/^\/users\/(?!new$)[^/]+$/i, /^\/share/i, 'some-other-page']
Swetrix.trackViews({
callback: ({ pg, prev }) => {
const result = {
pg,
prev,
}
if (checkIgnore(pg, pathsToIgnore)) {
// or you can return any other value to ignore this page
// for example, returning null will display REDACTED for this page in your dashboard
// but instead you can return something like 'users/:id' to group all users pages together
result.pg = null
}
if (checkIgnore(prev, pathsToIgnore)) {
// same as above
result.prev = null
}
return result
},
heartbeatOnBackground: true,
})
```
### [`v2.4.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v2.4.0)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v2.3.1...v2.4.0)
Changelog:
- Added support for **hash** and **search** based routing ([#10](https://togithub.com/Swetrix/swetrix-js/issues/10))
- Exposing a new `trackPageview` function to manually track pageviews. (https://github.com/Swetrix/swetrix-js/commit/77ce79783eebf2ac32291939d46aa2e9ea8701b3)
### [`v2.3.1`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v2.3.1)
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v2.3.0...v2.3.1)
Changelog:
- (feature) Now you can track metadata with custom events by passing `meta` object into the `track()` funciton. ([https://github.com/Swetrix/swetrix-js/pull/8](https://togithub.com/Swetrix/swetrix-js/pull/8))
### [`v2.3.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v2.3.0): - the 5 September 2023 Release
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v2.2.1...v2.3.0)
Changelog:
- Added a `doNotAnonymise` parameter to `trackViews` function. It allows to not send paths from ignore list to API. If set to `false`, the page view information will be sent to the Swetrix API, but the page will be displayed as a 'Redacted page' in the dashboard.
- Updated a few dependencies.
### [`v2.2.1`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v2.2.1): - the 27 April 2023 Release
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v2.2.0...v2.2.1)
Changelog:
- Fixed a bug when `previous` page was sent without validating it with `ignore` parameter first.
### [`v2.2.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v2.2.0): - the 26 April 2023 Release
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v2.1.0...v2.2.0)
Changelog:
- Added support for tracking user flow (by sending the previous page user was on to the server).
- Added `noUserFlow` boolean parameter to `PageViewsOptions`. If you want to disable user flow tracking, just set this parameter to `true`. By default it's `false` which means that the user flow tracking is enabled.
### [`v2.1.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v2.1.0): - the 9 February 2023 Release
[Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v2.0.1...v2.1.0)
Changelog:
- Sending additional data to the API along with the custom event.
- Updated dependencies.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
^2.0.1
->^3.0.0
Release Notes
Swetrix/swetrix-js (swetrix)
### [`v3.3.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.3.0) [Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.2.1...v3.3.0) - Using `fetch` API instead of `XMLHttpRequest` ([https://github.com/Swetrix/swetrix-js/issues/14](https://togithub.com/Swetrix/swetrix-js/issues/14)) - Returning a promise from `track` method ### [`v3.2.1`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.2.1) [Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.2.0...v3.2.1) Changelog: - Exporting internal interfaces. - `pageview` function now adds `prev` parameter by default. ### [`v3.2.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.2.0) [Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.1.1...v3.2.0) Changelog: - Added `meta` to `IPageViewPayload` interface. Now you can supply metadata with your pageview events just like on custom events. - Deprecated `trackPageview` function in favour of `pageview`. ### [`v3.1.1`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.1.1) [Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.1.0...v3.1.1) Changelog: - fix: `callback` in `trackErrors` function was not evoking properly ### [`v3.1.0`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.1.0) [Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.0.3...v3.1.0) Changelog: **1. Introducing Error tracking!** This release adds 2 new methods: [trackErrors](https://docs.swetrix.com/swetrix-js-reference#trackerrors) and [trackError](https://docs.swetrix.com/swetrix-js-reference#trackerror) which allow you to track client-side errors on your websites. 2\. Updated a few misc dependencies. ### [`v3.0.3`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.0.3) [Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.0.2...v3.0.3) Changelog: - Fix types for the v3.0.2 release. For full v3 release notes see https://github.com/Swetrix/swetrix-js/releases/tag/v3.0.0 ### [`v3.0.2`](https://togithub.com/Swetrix/swetrix-js/releases/tag/v3.0.2) [Compare Source](https://togithub.com/Swetrix/swetrix-js/compare/v3.0.1...v3.0.2) Changelog: - `trackViews` callback - updated return type from `IPageViewPayload` to `PartialConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.