Skip to content

fix(deps): update dependency swetrix to v3 #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jan 29, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
swetrix (source) ^2.0.1 -> ^3.0.0 age adoption passing confidence

Release Notes

Swetrix/swetrix-js (swetrix)

v3.5.2

Compare Source

Changelog:

  • Fix broken CJS imports (Error [ERR_REQUIRE_ESM]: require() of ES Module ...) for the NPM version

v3.5.1

Compare Source

Changelog:

  • Added exports to package.json (thanks @​KaelWD / https://github.com/Swetrix/swetrix-js/pull/17)
  • The swetrix.orig.js file has been removed from the dist. It was not described in the documentation and was not recommended to be used, but if you were using this file, please opt to use swetrix.js instead.

Other than that, there were no other user-facing changes.

DX wise:

  • package-lock.json is now removed from .gitignore
  • Updated all the dependencies to the latest version.
  • At least node 22 is now required to build this package.

v3.5.0

Compare Source

Changelog:

  • Remove prev parameter from pageview tracking.

v3.4.1

Compare Source

Changelog:

  • Added types for UTM Term and UTM Content.

v3.4.0

Compare Source

Changelog:

  • Added support for UTM Term and UTM Content for analytics & custom events.

v3.3.0

Compare Source

v3.2.1

Compare Source

Changelog:

  • Exporting internal interfaces.
  • pageview function now adds prev parameter by default.

v3.2.0

Compare Source

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

Compare Source

Changelog:

  • fix: callback in trackErrors function was not evoking properly

v3.1.0

Compare Source

Changelog:
1. Introducing Error tracking! This release adds 2 new methods: trackErrors and trackError which allow you to track client-side errors on your websites.
2. Updated a few misc dependencies.

v3.0.3

Compare Source

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

Compare Source

Changelog:

  • trackViews callback - updated return type from IPageViewPayload to Partial<IPageViewPayload>

For full v3 release notes see https://github.com/Swetrix/swetrix-js/releases/tag/v3.0.0

v3.0.1

Compare Source

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

Compare Source

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:
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:

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:

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

Compare Source

Changelog:

v2.3.1

Compare Source

Changelog:

v2.3.0: - the 5 September 2023 Release

Compare Source

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: - the 27 April 2023 Release

Compare Source

Changelog:

  • Fixed a bug when previous page was sent without validating it with ignore parameter first.

v2.2.0: - the 26 April 2023 Release

Compare Source

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: - the 9 February 2023 Release

Compare Source

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 was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/swetrix-3.x branch from f85b8e2 to 1dd2417 Compare February 27, 2024 13:55
@renovate renovate bot force-pushed the renovate/swetrix-3.x branch from 1dd2417 to beb73ac Compare May 8, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants