📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
format
Blue Mouse66a44baa4788
diff --git a/LICENSE.md b/LICENSE.mdindex 3b7b82d0d..79d1e89b1 100644--- a/LICENSE.md+++ b/LICENSE.md@@ -33,7 +33,7 @@ exhaustive, and do not form part of our licenses.material not subject to the license. This includes other CC-licensed material, or material used under an exception orlimitation to copyright. More considerations for licensors:- wiki.creativecommons.org/Considerations_for_licensors+ wiki.creativecommons.org/Considerations_for_licensorsConsiderations for the public: By using one of our publiclicenses, a licensor grants the public permission to use the@@ -50,7 +50,7 @@ exhaustive, and do not form part of our licenses.Although not required by our licenses, you are encouraged torespect those requests where reasonable. More_considerationsfor the public:- wiki.creativecommons.org/Considerations_for_licensees+ wiki.creativecommons.org/Considerations_for_licensees=======================================================================@@ -67,82 +67,80 @@ such rights in consideration of benefits the Licensor receives frommaking the Licensed Material available under these terms andconditions.-Section 1 -- Definitions.- a. Adapted Material means material subject to Copyright and Similar- Rights that is derived from or based upon the Licensed Material- and in which the Licensed Material is translated, altered,- arranged, transformed, or otherwise modified in a manner requiring- permission under the Copyright and Similar Rights held by the- Licensor. For purposes of this Public License, where the Licensed- Material is a musical work, performance, or sound recording,- Adapted Material is always produced where the Licensed Material is- synched in timed relation with a moving image.-- b. Adapter's License means the license You apply to Your Copyright- and Similar Rights in Your contributions to Adapted Material in- accordance with the terms and conditions of this Public License.-- c. BY-SA Compatible License means a license listed at- creativecommons.org/compatiblelicenses, approved by Creative- Commons as essentially the equivalent of this Public License.-- d. Copyright and Similar Rights means copyright and/or similar rights- closely related to copyright including, without limitation,- performance, broadcast, sound recording, and Sui Generis Database- Rights, without regard to how the rights are labeled or- categorized. For purposes of this Public License, the rights- specified in Section 2(b)(1)-(2) are not Copyright and Similar- Rights.-- e. Effective Technological Measures means those measures that, in the- absence of proper authority, may not be circumvented under laws- fulfilling obligations under Article 11 of the WIPO Copyright- Treaty adopted on December 20, 1996, and/or similar international- agreements.-- f. Exceptions and Limitations means fair use, fair dealing, and/or- any other exception or limitation to Copyright and Similar Rights- that applies to Your use of the Licensed Material.-- g. License Elements means the license attributes listed in the name- of a Creative Commons Public License. The License Elements of this- Public License are Attribution and ShareAlike.-- h. Licensed Material means the artistic or literary work, database,- or other material to which the Licensor applied this Public- License.-- i. Licensed Rights means the rights granted to You subject to the- terms and conditions of this Public License, which are limited to- all Copyright and Similar Rights that apply to Your use of the- Licensed Material and that the Licensor has authority to license.-- j. Licensor means the individual(s) or entity(ies) granting rights- under this Public License.-- k. Share means to provide material to the public by any means or- process that requires permission under the Licensed Rights, such- as reproduction, public display, public performance, distribution,- dissemination, communication, or importation, and to make material- available to the public including in ways that members of the- public may access the material from a place and at a time- individually chosen by them.-- l. Sui Generis Database Rights means rights other than copyright- resulting from Directive 96/9/EC of the European Parliament and of- the Council of 11 March 1996 on the legal protection of databases,- as amended and/or succeeded, as well as other essentially- equivalent rights anywhere in the world.-- m. You means the individual or entity exercising the Licensed Rights- under this Public License. Your has a corresponding meaning.-+a. Adapted Material means material subject to Copyright and Similar+Rights that is derived from or based upon the Licensed Material+and in which the Licensed Material is translated, altered,+arranged, transformed, or otherwise modified in a manner requiring+permission under the Copyright and Similar Rights held by the+Licensor. For purposes of this Public License, where the Licensed+Material is a musical work, performance, or sound recording,+Adapted Material is always produced where the Licensed Material is+synched in timed relation with a moving image.++b. Adapter's License means the license You apply to Your Copyright+and Similar Rights in Your contributions to Adapted Material in+accordance with the terms and conditions of this Public License.++c. BY-SA Compatible License means a license listed at+creativecommons.org/compatiblelicenses, approved by Creative+Commons as essentially the equivalent of this Public License.++d. Copyright and Similar Rights means copyright and/or similar rights+closely related to copyright including, without limitation,+performance, broadcast, sound recording, and Sui Generis Database+Rights, without regard to how the rights are labeled or+categorized. For purposes of this Public License, the rights+specified in Section 2(b)(1)-(2) are not Copyright and Similar+Rights.++e. Effective Technological Measures means those measures that, in the+absence of proper authority, may not be circumvented under laws+fulfilling obligations under Article 11 of the WIPO Copyright+Treaty adopted on December 20, 1996, and/or similar international+agreements.++f. Exceptions and Limitations means fair use, fair dealing, and/or+any other exception or limitation to Copyright and Similar Rights+that applies to Your use of the Licensed Material.++g. License Elements means the license attributes listed in the name+of a Creative Commons Public License. The License Elements of this+Public License are Attribution and ShareAlike.++h. Licensed Material means the artistic or literary work, database,+or other material to which the Licensor applied this Public+License.++i. Licensed Rights means the rights granted to You subject to the+terms and conditions of this Public License, which are limited to+all Copyright and Similar Rights that apply to Your use of the+Licensed Material and that the Licensor has authority to license.++j. Licensor means the individual(s) or entity(ies) granting rights+under this Public License.++k. Share means to provide material to the public by any means or+process that requires permission under the Licensed Rights, such+as reproduction, public display, public performance, distribution,+dissemination, communication, or importation, and to make material+available to the public including in ways that members of the+public may access the material from a place and at a time+individually chosen by them.++l. Sui Generis Database Rights means rights other than copyright+resulting from Directive 96/9/EC of the European Parliament and of+the Council of 11 March 1996 on the legal protection of databases,+as amended and/or succeeded, as well as other essentially+equivalent rights anywhere in the world.++m. You means the individual or entity exercising the Licensed Rights+under this Public License. Your has a corresponding meaning.Section 2 -- Scope.- a. License grant.+a. License grant.1. Subject to the terms and conditions of this Public License,the Licensor hereby grants You a worldwide, royalty-free,@@ -202,7 +200,7 @@ Section 2 -- Scope.the Licensor or others designated to receive attribution asprovided in Section 3(a)(1)(A)(i).- b. Other rights.+b. Other rights.1. Moral rights, such as the right of integrity, are notlicensed under this Public License, nor are publicity,@@ -222,13 +220,12 @@ Section 2 -- Scope.licensing scheme. In all other cases the Licensor expresslyreserves any right to collect such royalties.-Section 3 -- License Conditions.Your exercise of the Licensed Rights is expressly made subject to thefollowing conditions.- a. Attribution.+a. Attribution.1. If You Share the Licensed Material (including in modifiedform), You must:@@ -270,7 +267,7 @@ following conditions.information required by Section 3(a)(1)(A) to the extentreasonably practicable.- b. ShareAlike.+b. ShareAlike.In addition to the conditions in Section 3(a), if You ShareAdapted Material You produce, the following conditions also apply.@@ -289,68 +286,66 @@ following conditions.Measures to, Adapted Material that restrict exercise of therights granted under the Adapter's License You apply.-Section 4 -- Sui Generis Database Rights.Where the Licensed Rights include Sui Generis Database Rights thatapply to Your use of the Licensed Material:- a. for the avoidance of doubt, Section 2(a)(1) grants You the right- to extract, reuse, reproduce, and Share all or a substantial- portion of the contents of the database;+a. for the avoidance of doubt, Section 2(a)(1) grants You the right+to extract, reuse, reproduce, and Share all or a substantial+portion of the contents of the database;- b. if You include all or a substantial portion of the database- contents in a database in which You have Sui Generis Database- Rights, then the database in which You have Sui Generis Database- Rights (but not its individual contents) is Adapted Material,+b. if You include all or a substantial portion of the database+contents in a database in which You have Sui Generis Database+Rights, then the database in which You have Sui Generis Database+Rights (but not its individual contents) is Adapted Material,including for purposes of Section 3(b); and- c. You must comply with the conditions in Section 3(a) if You Share- all or a substantial portion of the contents of the database.++c. You must comply with the conditions in Section 3(a) if You Share+all or a substantial portion of the contents of the database.For the avoidance of doubt, this Section 4 supplements and does notreplace Your obligations under this Public License where the LicensedRights include other Copyright and Similar Rights.-Section 5 -- Disclaimer of Warranties and Limitation of Liability.- a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE- EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS- AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF- ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,- IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,- WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR- PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,- ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT- KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT- ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.-- b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE- TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,- NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,- INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,- COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR- USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN- ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR- DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR- IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.-- c. The disclaimer of warranties and limitation of liability provided- above shall be interpreted in a manner that, to the extent- possible, most closely approximates an absolute disclaimer and- waiver of all liability.-+a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE+EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS+AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF+ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,+IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,+WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR+PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,+ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT+KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT+ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.++b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE+TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,+NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,+INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,+COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR+USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN+ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR+DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR+IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.++c. The disclaimer of warranties and limitation of liability provided+above shall be interpreted in a manner that, to the extent+possible, most closely approximates an absolute disclaimer and+waiver of all liability.Section 6 -- Term and Termination.- a. This Public License applies for the term of the Copyright and- Similar Rights licensed here. However, if You fail to comply with- this Public License, then Your rights under this Public License- terminate automatically.+a. This Public License applies for the term of the Copyright and+Similar Rights licensed here. However, if You fail to comply with+this Public License, then Your rights under this Public License+terminate automatically.- b. Where Your right to use the Licensed Material has terminated under- Section 6(a), it reinstates:+b. Where Your right to use the Licensed Material has terminated under+Section 6(a), it reinstates:1. automatically as of the date the violation is cured, providedit is cured within 30 days of Your discovery of the@@ -362,48 +357,45 @@ Section 6 -- Term and Termination.right the Licensor may have to seek remedies for Your violationsof this Public License.- c. For the avoidance of doubt, the Licensor may also offer the- Licensed Material under separate terms or conditions or stop- distributing the Licensed Material at any time; however, doing so- will not terminate this Public License.-- d. Sections 1, 5, 6, 7, and 8 survive termination of this Public- License.+c. For the avoidance of doubt, the Licensor may also offer the+Licensed Material under separate terms or conditions or stop+distributing the Licensed Material at any time; however, doing so+will not terminate this Public License.+d. Sections 1, 5, 6, 7, and 8 survive termination of this Public+License.Section 7 -- Other Terms and Conditions.- a. The Licensor shall not be bound by any additional or different- terms or conditions communicated by You unless expressly agreed.-- b. Any arrangements, understandings, or agreements regarding the- Licensed Material not stated herein are separate from and- independent of the terms and conditions of this Public License.+a. The Licensor shall not be bound by any additional or different+terms or conditions communicated by You unless expressly agreed.+b. Any arrangements, understandings, or agreements regarding the+Licensed Material not stated herein are separate from and+independent of the terms and conditions of this Public License.Section 8 -- Interpretation.- a. For the avoidance of doubt, this Public License does not, and- shall not be interpreted to, reduce, limit, restrict, or impose- conditions on any use of the Licensed Material that could lawfully- be made without permission under this Public License.+a. For the avoidance of doubt, this Public License does not, and+shall not be interpreted to, reduce, limit, restrict, or impose+conditions on any use of the Licensed Material that could lawfully+be made without permission under this Public License.- b. To the extent possible, if any provision of this Public License is- deemed unenforceable, it shall be automatically reformed to the- minimum extent necessary to make it enforceable. If the provision- cannot be reformed, it shall be severed from this Public License- without affecting the enforceability of the remaining terms and- conditions.-- c. No term or condition of this Public License will be waived and no- failure to comply consented to unless expressly agreed to by the- Licensor.+b. To the extent possible, if any provision of this Public License is+deemed unenforceable, it shall be automatically reformed to the+minimum extent necessary to make it enforceable. If the provision+cannot be reformed, it shall be severed from this Public License+without affecting the enforceability of the remaining terms and+conditions.- d. Nothing in this Public License constitutes or may be interpreted- as a limitation upon, or waiver of, any privileges and immunities- that apply to the Licensor or You, including from the legal- processes of any jurisdiction or authority.+c. No term or condition of this Public License will be waived and no+failure to comply consented to unless expressly agreed to by the+Licensor.+d. Nothing in this Public License constitutes or may be interpreted+as a limitation upon, or waiver of, any privileges and immunities+that apply to the Licensor or You, including from the legal+processes of any jurisdiction or authority.=======================================================================diff --git a/docs/accountsettings/other-settings.md b/docs/accountsettings/other-settings.mdindex 38cf83ca6..6677dad86 100644--- a/docs/accountsettings/other-settings.md+++ b/docs/accountsettings/other-settings.md@@ -16,7 +16,7 @@ A popup window will be opened prompting you to log into the account you want toAfter you connect it, you will be able to login to Swetrix using this account. You can also unlink it at any time.:::note-Please note that if you used Google or Github SSO feature to create an account, you will not be able to unlink it.+Please note that if you used Google or Github SSO feature to create an account, you will not be able to unlink it.:::## How to change reporting timezonediff --git a/docs/accountsettings/two-factor-authentication.md b/docs/accountsettings/two-factor-authentication.mdindex d58249ca1..85d156507 100644--- a/docs/accountsettings/two-factor-authentication.md+++ b/docs/accountsettings/two-factor-authentication.md@@ -8,7 +8,8 @@ import useBaseUrl from '@docusaurus/useBaseUrl';Two-factor authentication (2FA) adds a second layer of defense to your account, so even if someone gets hold of your password they still can’t sign in.Once 2FA is enabled, when you try to log into your account you’ll need:-1. Your account password, and++1. Your account password, and2. A one-time verification code generated on a trusted device.To enable 2FA, you'll need to scan our 2FA QR code with your authenticator app and enter the generated code to Swetrix account settings. Any TOTP generator app works, but we recommend Ente Auth (Android, iOS, Web), Aegis Authenticator (Android) or Bitwarden.@@ -39,4 +40,4 @@ In the input field shown afterwards, enter a one-time code generated by your aut:::warningOnce you disable the 2FA, verification codes from the authenticator application and saved recovery codes will become invalid.-:::\ No newline at end of file+:::diff --git a/docs/adblockers/guides/netlify.md b/docs/adblockers/guides/netlify.mdindex b1ed7f563..72cc1ac71 100644--- a/docs/adblockers/guides/netlify.md+++ b/docs/adblockers/guides/netlify.md@@ -6,7 +6,9 @@ slug: /adblockers/guides/netlifyYou can use [Netlify redirects](https://docs.netlify.com/routing/redirects/) to proxy Swetrix analytics traffic via your domain.## Setup Netlify rewrites rules+First, you need to add the following rules to the `_redirects` file. If you don't already have it, you will need to [create it](https://docs.netlify.com/routing/redirects/rewrites-proxies/) first.+```/script.js https://swetrix.org/swetrix.js 200/sproxy https://api.swetrix.com/log 200@@ -19,6 +21,7 @@ Make sure you don't use `/log`, `/analytics`, `/analytics.js` or any similar nam:::## Update Swetrix tracking script configuration+After you set up Netlify redirect rules, you need to update swetrix.js tracking script to send analytics data through it. You can do it by setting the `apiURL` property inside the [init() function](/swetrix-js-reference#init).```javascriptdiff --git a/docs/adblockers/guides/nextjs.md b/docs/adblockers/guides/nextjs.mdindex b561aeaf1..714e98127 100644--- a/docs/adblockers/guides/nextjs.md+++ b/docs/adblockers/guides/nextjs.md@@ -6,16 +6,18 @@ slug: /adblockers/guides/nextjsYou can use [Next.js](https://nextjs.org/) to proxy Swetrix analytics traffic via your domain.## Setup Next.js rewrites rules+First, you need to add the following rules to the `next.config.js` file. If you don't already have it, you will need to [create it](https://nextjs.org/docs/pages/api-reference/next-config-js/rewrites) in your project's root directory first.+```javascriptmodule.exports = {async rewrites() {return [{- source: "/sproxy/:path*",- destination: "https://api.swetrix.com/log/:path*",+ source: '/sproxy/:path*',+ destination: 'https://api.swetrix.com/log/:path*',},- ];+ ]},}```@@ -29,6 +31,7 @@ If you are not using the [Swetrix NPM package](/install-script#install-swetrix-v:::## Update Swetrix tracking script configuration+After you set up Next.js redirect rules, you need to update swetrix.js tracking script to send analytics data through it. You can do it by setting the `apiURL` property inside the [init() function](/swetrix-js-reference#init).```javascriptdiff --git a/docs/adblockers/guides/nginx.md b/docs/adblockers/guides/nginx.mdindex 724687f1a..1b0ec5205 100644--- a/docs/adblockers/guides/nginx.md+++ b/docs/adblockers/guides/nginx.md@@ -6,6 +6,7 @@ slug: /adblockers/guides/nginxIf you are already using Nginx on your website, you can add Swetrix to your configuration to proxy it.## Update your Nginx configuration+```# The `proxy_cache` part is only needed if you cache swetrix.js script.# If you use Swetrix from NPM, there's no need to proxy it.@@ -54,6 +55,7 @@ server {```## Update Swetrix tracking script configuration+After you updated your Nginx configuration, you need to update swetrix.js tracking script to send analytics data through your server. You can do it by setting the `apiURL` property inside the [init() function](/swetrix-js-reference#init).```javascriptdiff --git a/docs/adblockers/how-to-deal-with-adblockers.md b/docs/adblockers/how-to-deal-with-adblockers.mdindex a337a2b3d..776a404f8 100644--- a/docs/adblockers/how-to-deal-with-adblockers.md+++ b/docs/adblockers/how-to-deal-with-adblockers.md@@ -12,6 +12,7 @@ Nevertheless, Swetrix is an open source, privacy-focused, cookie-less web analytOn average, [32% of users](https://backlinko.com/ad-blockers-users?ref=swetrix) use adblockers, but it depends on your site's audience (tech audiences tend to use adblockers much more). If you're not concerned about missing data, we recommend using one of our standard [integration guides](/integrations).## How to proxy Swetrix+The most effective way to bypass ad blockers is to proxy the Swetrix script and calls to the Swetrix servers through this script.A proxy is basically the mapping of our servers' URLs through your domain. So analytics requests will not be sent to `https://api.swetrix.com/log`, but instead to `https://<your domain>/path`.@@ -19,11 +20,13 @@ A proxy is basically the mapping of our servers' URLs through your domain. So anThe advantage of this approach is that your site will only make first-party requests, preventing them from being blocked by adblockers.### How to proxy tracking script?+If you've installed [Swetrix using npm](/install-script#install-swetrix-via-npm), you don't need to proxy it as it's already bundled into your web application's code (but you still need to proxy our API, see one of the proxy guides below).If you have installed Swetrix using our CDN (`swetrix.org/swetrix.js`), you will need to proxy it to bypass adblockers. Please refer to one of the guides below on how to do this.### Managed proxy guides- - [Netlify](/adblockers/guides/netlify)- - [Next.js](/adblockers/guides/nextjs)- - [Nginx](/adblockers/guides/nginx)++- [Netlify](/adblockers/guides/netlify)+- [Next.js](/adblockers/guides/nextjs)+- [Nginx](/adblockers/guides/nginx)diff --git a/docs/add-script.md b/docs/add-script.mdindex 7124d85ab..2d0200ad3 100644--- a/docs/add-script.md+++ b/docs/add-script.md@@ -8,13 +8,14 @@ import useBaseUrl from '@docusaurus/useBaseUrl';To use Swetrix on your website, you need to add a tracking script to your website and there are several ways to do this.## Edit the website's HTML code+The easiest way to add the tracking script to your website is to edit the HTML code of your website.To do this, paste the following code snippet into the Body section (`<body>` tag). You have to place the script within the `<body>...</body>` tags.```html<script src="https://swetrix.org/swetrix.js" defer></script><script>- document.addEventListener('DOMContentLoaded', function() {+ document.addEventListener('DOMContentLoaded', function () {swetrix.init('YOUR_PROJECT_ID')swetrix.trackViews()})@@ -36,6 +37,7 @@ It's important to remember to replace `YOUR_PROJECT_ID` with your actual ProjectDone. Now you can start using Swetrix on your website.## Install Swetrix via npm+If you are using a website based on a JavaScript framework such as React or Vue, you can install Swetrix via npm and use it on your website.To install Swetrix using npm, run the following command in your terminal:@@ -58,6 +60,7 @@ Swetrix.trackViews()```## Integration with CMS or site builders+Sometimes it may be easier to install Swetrix without editing the HTML code of your website and this is the case with some CMS or site builders, for example WordPress or Wix.We support a number of different integrations and you can read more about them [here](integrations).diff --git a/docs/affiliate/terms.md b/docs/affiliate/terms.mdindex 32a412cde..7fbdb9c76 100644--- a/docs/affiliate/terms.md+++ b/docs/affiliate/terms.md@@ -18,6 +18,7 @@ By signing up for the Swetrix ("Affiliate program") you are agreeing to be bound- Do not include our affiliate links or program on discount websites, coupon websites, or deal websites## If you intend to promote our affiliate program on your website or link to our website+- Your website cannot in any way copy or resemble the look and feel of our website. You may not create or design your website or any other website that you operate, explicitly or implied in a manner which resembles our website nor design your website in a manner which leads customers to believe you are Swetrix or any other affiliated business- You may not engage in cookie stuffing or include pop-ups, false or misleading links on your website. In addition, wherever possible, you will not attempt to mask the referring URL information (i.e. the page from where the click is originating)- You may not use redirects to bounce a click off of a domain from which the click did not originate in order to give the appearance that it came from that domain@@ -26,6 +27,7 @@ By signing up for the Swetrix ("Affiliate program") you are agreeing to be bound- You may not purchase ads to promote our affiliate program or your affiliate link## If you intend to promote our affiliate program via email you must adhere to the following+- You must comply with the CAN-SPAM Act of 2003 (Public Law No. 108-187) and all other applicable laws and regulations with respect to our affiliate program- You must not use unsolicited email, SMS or other messages that violate any law or regulation- Emails or other communications must be sent on your behalf and must not imply that the communication is being sent on behalf of Swetrixdiff --git a/docs/api/admin.md b/docs/api/admin.mdindex 0e94128fc..92d6b4d4b 100644--- a/docs/api/admin.md+++ b/docs/api/admin.md@@ -9,38 +9,45 @@ Each request must be authenticated with an API key using `X-Api-Key` HTTP headerRate limit for the API depends on your plan, you can find more information on the billing (or the main) page.As of 9 February 2023, the rate limits are as follows:+- **Free plan**: 600 requests per hour;- **Any paid plan**: 600 requests per hour.If you have special needs for more requests, please [contact us](https://swetrix.com/contact) to request more capacity.## Concepts+### Projects manipulation+#### 'Create project' payload-| Name | Type | Required | Description |-| --- | --- | --- | --- |-| `name` | `string` | `true` | A display name for your project, max length is 50 chars. |-| `isCaptcha` | `boolean` | `false` | (Only supported when creating a new project). Set to `true` if your project is a [CAPTCHA](/captcha/introduction) project. `false` by default. |-| `isPasswordProtected` | `boolean` | `false` | Set to `true` if your project's dashboard should be password protected. `false` by default. |-| `password` | `string` | `false` | Required only if `isPasswordProtected` is set to `true`. That is the password unauthorised people will have to enter to access your project's dashboard. |-| `organisationId` | `string` | `false` | Organisation you want to add this project to. You must be an owner or admin of the organisation to add a project to it. |++| Name | Type | Required | Description |+| --------------------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `name` | `string` | `true` | A display name for your project, max length is 50 chars. |+| `isCaptcha` | `boolean` | `false` | (Only supported when creating a new project). Set to `true` if your project is a [CAPTCHA](/captcha/introduction) project. `false` by default. |+| `isPasswordProtected` | `boolean` | `false` | Set to `true` if your project's dashboard should be password protected. `false` by default. |+| `password` | `string` | `false` | Required only if `isPasswordProtected` is set to `true`. That is the password unauthorised people will have to enter to access your project's dashboard. |+| `organisationId` | `string` | `false` | Organisation you want to add this project to. You must be an owner or admin of the organisation to add a project to it. |#### 'Update project' payload-| Name | Type | Description |-| --- | --- | --- |-| `name` | `string` | A display name for your project, max length is 50 chars. |-| `isCaptcha` | `boolean` | (Only supported when creating a new project). Set to `true` if your project is a [CAPTCHA](/captcha/introduction) project. `false` by default. |-| `active` | `boolean` | Set to `true` if your project should be active and accept incoming traffic. |-| `public` | `boolean` | Set to `true` if your project should have a publicly available dashboard. |-| `isPasswordProtected` | `boolean` | Set to `true` if your project's dashboard should be password protected. `false` by default. |-| `password` | `string` | Required only if `isPasswordProtected` is set to `true`. That is the password unauthorised people will have to enter to access your project's dashboard. |-| `origins` | `Array<string>` | An array of origins (domains) which are allowed to use script with your ProjectID. For example: `['cornell.edu', 'app.example.com', '*.gov.ua']`. By default all origins are allowed. |-| `ipBlacklist` | `Array<string>` | An aeeay of IP addresses from which no analytics will be collected on this project. This functionality is handy if you want to ignore analytics from your IP. For example: `['172.126.10.16', '192.168.0.1/32', '::1']` |-| `botsProtectionLevel` | `off` or `basic` | Set to `basic` or `off`. `basic` will block common bots by user agent and `off` will allow all traffic. `basic` by default. |-| `organisationId` | `string` | Organisation you want to add this project to. You must be an owner or admin of the organisation to add a project to it. |++| Name | Type | Description |+| --------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `name` | `string` | A display name for your project, max length is 50 chars. |+| `isCaptcha` | `boolean` | (Only supported when creating a new project). Set to `true` if your project is a [CAPTCHA](/captcha/introduction) project. `false` by default. |+| `active` | `boolean` | Set to `true` if your project should be active and accept incoming traffic. |+| `public` | `boolean` | Set to `true` if your project should have a publicly available dashboard. |+| `isPasswordProtected` | `boolean` | Set to `true` if your project's dashboard should be password protected. `false` by default. |+| `password` | `string` | Required only if `isPasswordProtected` is set to `true`. That is the password unauthorised people will have to enter to access your project's dashboard. |+| `origins` | `Array<string>` | An array of origins (domains) which are allowed to use script with your ProjectID. For example: `['cornell.edu', 'app.example.com', '*.gov.ua']`. By default all origins are allowed. |+| `ipBlacklist` | `Array<string>` | An aeeay of IP addresses from which no analytics will be collected on this project. This functionality is handy if you want to ignore analytics from your IP. For example: `['172.126.10.16', '192.168.0.1/32', '::1']` |+| `botsProtectionLevel` | `off` or `basic` | Set to `basic` or `off`. `basic` will block common bots by user agent and `off` will allow all traffic. `basic` by default. |+| `organisationId` | `string` | Organisation you want to add this project to. You must be an owner or admin of the organisation to add a project to it. |## Endpoints+### POST /v1/project+This endpoint allows you to create a new project.```bash title="Request"@@ -73,6 +80,7 @@ curl -i -X POST https://api.swetrix.com/v1/project \```### PUT /v1/project/:id+This endpoint allows you to edit an existing project.```bash title="Request"@@ -86,10 +94,7 @@ curl -i -X PUT https://api.swetrix.com/v1/project/WvZCYTrOPzSK \{"id": "WvZCYTrOPzSK","name": "PASSWORD PROTECTED",- "origins": [- "example.com",- "example.co.uk"- ],+ "origins": ["example.com", "example.co.uk"],"ipBlacklist": null,"active": true,"public": true,@@ -108,6 +113,7 @@ curl -i -X PUT https://api.swetrix.com/v1/project/WvZCYTrOPzSK \```### DELETE /v1/project/:id+This endpoint allows you to delete a project.```bash title="Request"@@ -117,9 +123,11 @@ curl -i -X DELETE https://api.swetrix.com/v1/project/WvZCYTrOPzSK \``````json title="Response (204 No Content)"+```### PATCH /v1/project/:id/organisation+This endpoint allows you to assign a project to an organisation, or unassign it from an organisation. To unassign a project from an organisation, don't pass the request body.```bash title="Request"@@ -130,21 +138,28 @@ curl -i -X PATCH https://api.swetrix.com/v1/project/WvZCYTrOPzSK/organisation \``````json title="Response (204 No Content)"+```## Status and error codes+### 200 OK+Typical successful response when updating a project or account settings.### 201 Created+The request was successful and the project was created.### 204 No Content+The request was successful and there is no data to return. Usually this code is sent when deleting an entity.### 400 Bad Request+This error is usually returned when the request body is malformed (for example, the `pid` parameter is missing or invalid).### 500 Internal Server Error+This error is usually returned when the server is unable to process the request due to a temporary problem (for example, the database is unavailable).If you receive this error, please try again later. If the problem persists, please [contact us](https://swetrix.com/contact).diff --git a/docs/api/events.md b/docs/api/events.mdindex e3d5f11a6..8da962617 100644--- a/docs/api/events.md+++ b/docs/api/events.md@@ -8,7 +8,9 @@ With Swetrix you can programmatically record page views or custom events manuallWe already provide several [integrations](/integrations) and a [script](/swetrix-js-reference) for this, but if for some reason none of these options work for you, you can use the Events API instead.## Concepts+### Unique visitors tracking+:::cautionFor the unique (and live) visitor functionality to work properly, each request must have the `User-Agent` and `X-Client-IP-Address` HTTP headers set. If you don't set these headers, the API will still work, but the unique visitor count will be incorrect.:::@@ -16,83 +18,95 @@ For the unique (and live) visitor functionality to work properly, each request mThe API relies on the client's IP address and user agent to create a temporary session (a salted hash that is permanently removed from our database 30 minutes after the last interaction or at 12:00 AM UTC, whichever comes first). We **never** store any visitor identifiable information in our database.### Request headers+#### User-Agent+This header is used to determine the visitor's browser, operating system and device type. It's also used to determine whether or not the visitor is a bot.We also use this header to create a temporary session for the visitor.#### X-Client-IP-Address+This header is used to determine the visitor's IP address. You must pass the visitor's IP address using this header, otherwise the API will use the IP address of the server making the request (i.e. your server's IP address), resulting in incorrect unique and live visitor data.#### Content-Type+Must be set to `application/json` for all requests.### Pageview event structure+#### Pageview payload-| Name | Type | Required | Description |-| --- | --- | --- | --- |-| `pid` | `string` | `true` | A project ID to record the pageview event for |-| `tz` | `string` | `false` | Visitor's timezone (used as a backup in case IP geolocation fails). I.e. if it's set to `Europe/Kiev` and IP geolocation fails, we will set the country of this entry to `Ukraine`) |-| `pg` | `string` | `false` | A page to record the pageview event for (e.g. `/home`). All our scripts send the `pg` string with a slash (`/`) at the beginning, it's not a requirement but it's best to do the same so the data would be consistent when used together with our official scripts |-| `lc` | `string` | `false` | A locale of the user (e.g. `en-US` or `uk-UA`) |-| `ref` | `string` | `false` | A referrer URL (e.g. `https://example.com/`) |-| `so` | `string` | `false` | A source of the pageview (e.g. `ref`, `source` or `utm_source` GET parameter) |-| `me` | `string` | `false` | A medium of the pageview (e.g. `utm_medium` GET parameter) |-| `ca` | `string` | `false` | A campaign of the pageview (e.g. `utm_campaign` GET parameter) |-| `unique` | `boolean` | `false` | If set to true, only unique visits will be saved |-| `perf` | `object` | `false` | An object with performance metrics related to the page load. See [Performance metrics](#performance-metrics-payload) for more details |++| Name | Type | Required | Description |+| -------- | --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `pid` | `string` | `true` | A project ID to record the pageview event for |+| `tz` | `string` | `false` | Visitor's timezone (used as a backup in case IP geolocation fails). I.e. if it's set to `Europe/Kiev` and IP geolocation fails, we will set the country of this entry to `Ukraine`) |+| `pg` | `string` | `false` | A page to record the pageview event for (e.g. `/home`). All our scripts send the `pg` string with a slash (`/`) at the beginning, it's not a requirement but it's best to do the same so the data would be consistent when used together with our official scripts |+| `lc` | `string` | `false` | A locale of the user (e.g. `en-US` or `uk-UA`) |+| `ref` | `string` | `false` | A referrer URL (e.g. `https://example.com/`) |+| `so` | `string` | `false` | A source of the pageview (e.g. `ref`, `source` or `utm_source` GET parameter) |+| `me` | `string` | `false` | A medium of the pageview (e.g. `utm_medium` GET parameter) |+| `ca` | `string` | `false` | A campaign of the pageview (e.g. `utm_campaign` GET parameter) |+| `unique` | `boolean` | `false` | If set to true, only unique visits will be saved |+| `perf` | `object` | `false` | An object with performance metrics related to the page load. See [Performance metrics](#performance-metrics-payload) for more details |#### Performance metrics payload+This section describes the structure of the `perf` object which is used to record performance metrics related to the page loading.All of the values are numbers in milliseconds.-| Name | Type | Required | Description |-| --- | --- | --- | --- |-| `dns` | `number` | `false` | DNS Resolution time |-| `tls` | `number` | `false` | TLS handshake time |-| `conn` | `number` | `false` | Connection time |-| `response` | `number` | `false` | Response Time (Download) |-| `render` | `number` | `false` | Browser rendering the HTML page time |-| `dom_load` | `number` | `false` | DOM loading timing |-| `page_load` | `number` | `false` | Page load timing |-| `ttfb` | `number` | `false` | Time to first byte |+| Name | Type | Required | Description |+| ----------- | -------- | -------- | ------------------------------------ |+| `dns` | `number` | `false` | DNS Resolution time |+| `tls` | `number` | `false` | TLS handshake time |+| `conn` | `number` | `false` | Connection time |+| `response` | `number` | `false` | Response Time (Download) |+| `render` | `number` | `false` | Browser rendering the HTML page time |+| `dom_load` | `number` | `false` | DOM loading timing |+| `page_load` | `number` | `false` | Page load timing |+| `ttfb` | `number` | `false` | Time to first byte |### Custom event structure-| Name | Type | Required | Description |-| --- | --- | --- | --- |-| `pid` | `string` | `true` | A project ID to record the pageview event for |-| `ev` | `string` | `true` | An event identifier you want to track. This has to be a string, which:<br />1. Contains only English letters (a-Z A-Z), numbers (0-9), underscores (_) and dots (.).<br />2. Is fewer than 64 characters.<br />3. Starts with an English letter. |-| `unique` | `boolean` | `false` | If set to true, only 1 custom event will be saved per session |-| `pg` | `string` | `false` | A page that user sent data from (e.g. `/home`) |-| `lc` | `string` | `false` | A locale of the user (e.g. `en-US` or `uk-UA`) |-| `ref` | `string` | `false` | A referrer URL (e.g. `https://example.com/`) |-| `so` | `string` | `false` | A source of the pageview (e.g. `ref`, `source` or `utm_source` GET parameter) |-| `me` | `string` | `false` | A medium of the pageview (e.g. `utm_medium` GET parameter) |-| `ca` | `string` | `false` | A campaign of the pageview (e.g. `utm_campaign` GET parameter) |-| `meta` | `object` | `false` | A `key` / `value` pair of custom properties for your event (e.g. if your event is `signup`, you can include `meta` like `{ affiliate: 'Yes', currency: 'GBP' }`). The values of the object must be a primitive type (string, number, boolean, null) which will be converted to a string, the maximum number of keys allowed is 100 and the total length of the keys and values combined must be less than 2000 characters. |++| Name | Type | Required | Description |+| -------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `pid` | `string` | `true` | A project ID to record the pageview event for |+| `ev` | `string` | `true` | An event identifier you want to track. This has to be a string, which:<br />1. Contains only English letters (a-Z A-Z), numbers (0-9), underscores (\_) and dots (.).<br />2. Is fewer than 64 characters.<br />3. Starts with an English letter. |+| `unique` | `boolean` | `false` | If set to true, only 1 custom event will be saved per session |+| `pg` | `string` | `false` | A page that user sent data from (e.g. `/home`) |+| `lc` | `string` | `false` | A locale of the user (e.g. `en-US` or `uk-UA`) |+| `ref` | `string` | `false` | A referrer URL (e.g. `https://example.com/`) |+| `so` | `string` | `false` | A source of the pageview (e.g. `ref`, `source` or `utm_source` GET parameter) |+| `me` | `string` | `false` | A medium of the pageview (e.g. `utm_medium` GET parameter) |+| `ca` | `string` | `false` | A campaign of the pageview (e.g. `utm_campaign` GET parameter) |+| `meta` | `object` | `false` | A `key` / `value` pair of custom properties for your event (e.g. if your event is `signup`, you can include `meta` like `{ affiliate: 'Yes', currency: 'GBP' }`). The values of the object must be a primitive type (string, number, boolean, null) which will be converted to a string, the maximum number of keys allowed is 100 and the total length of the keys and values combined must be less than 2000 characters. |### Error event structure-| Name | Type | Required | Description |-| --- | --- | --- | --- |-| `pid` | `string` | `true` | A project ID to record the pageview event for |-| `name` | `string` | `true` | Error name (e.g. `ParseError`); Max length is 200 |-| `message` | `string` | `false` | Error message (e.g. `Malformed input`); Max length is 2000 |-| `lineno` | `number` | `false` | Line number |-| `colno` | `number` | `false` | Column number |-| `stackTrace` | `string` | `false` | Stack trace; Max length is 7500 |-| `filename` | `number` | `false` | Error message (e.g. `https://example.com/assets/convert.js`); Max length is 1000 |-| `tz` | `string` | `false` | Visitor's timezone (used as a backup in case IP geolocation fails). I.e. if it's set to `Europe/Kiev` and IP geolocation fails, we will set the country of this entry to `Ukraine`) |-| `pg` | `string` | `false` | A page that user sent data from (e.g. `/home`) |-| `lc` | `string` | `false` | A locale of the user (e.g. `en-US` or `uk-UA`) |-| `meta` | `object` | `false` | A `key` / `value` pair of custom properties for your event, for example `{ level: 'Critical' }`. The values of the object must be a primitive type (string, number, boolean, null) which will be converted to a string, the maximum number of keys allowed is 100 and the total length of the keys and values combined must be less than 2000 characters. |++| Name | Type | Required | Description |+| ------------ | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `pid` | `string` | `true` | A project ID to record the pageview event for |+| `name` | `string` | `true` | Error name (e.g. `ParseError`); Max length is 200 |+| `message` | `string` | `false` | Error message (e.g. `Malformed input`); Max length is 2000 |+| `lineno` | `number` | `false` | Line number |+| `colno` | `number` | `false` | Column number |+| `stackTrace` | `string` | `false` | Stack trace; Max length is 7500 |+| `filename` | `number` | `false` | Error message (e.g. `https://example.com/assets/convert.js`); Max length is 1000 |+| `tz` | `string` | `false` | Visitor's timezone (used as a backup in case IP geolocation fails). I.e. if it's set to `Europe/Kiev` and IP geolocation fails, we will set the country of this entry to `Ukraine`) |+| `pg` | `string` | `false` | A page that user sent data from (e.g. `/home`) |+| `lc` | `string` | `false` | A locale of the user (e.g. `en-US` or `uk-UA`) |+| `meta` | `object` | `false` | A `key` / `value` pair of custom properties for your event, for example `{ level: 'Critical' }`. The values of the object must be a primitive type (string, number, boolean, null) which will be converted to a string, the maximum number of keys allowed is 100 and the total length of the keys and values combined must be less than 2000 characters. |### Heartbeat event structure-| Name | Type | Required | Description |-| --- | --- | --- | --- |-| `pid` | `string` | `true` | A project ID to record the heartbeat event for |++| Name | Type | Required | Description |+| ----- | -------- | -------- | ---------------------------------------------- |+| `pid` | `string` | `true` | A project ID to record the heartbeat event for |## Endpoints+### POST /log+This endpoint records pageview events.```bash title="Request"@@ -108,6 +122,7 @@ curl -i -X POST https://api.swetrix.com/log \```### POST /log/custom+This endpoint records custom events.```bash title="Request"@@ -123,6 +138,7 @@ curl -i -X POST https://api.swetrix.com/log/custom \```### POST /log/hb+This endpoint is used for heartbeat events. Heartbeat events are used to determine if the user session is still active. This allows you to see the 'Live Visitors' counter in the Dashboard panel.It's recommended to send heartbeat events every 30 seconds. We also extend the session lifetime after receiving a pageview or custom event.@@ -139,6 +155,7 @@ curl -i -X POST https://api.swetrix.com/log/hb \```### POST /log/error+This endpoint records error events. These error events are later aggregated in the dashboard under the Errors tab.```bash title="Request"@@ -154,28 +171,37 @@ curl -i -X POST https://api.swetrix.com/log/error \```## Status and error codes+### 201 Created+The request was successful and the event was recorded.### 400 Bad Request+This error is usually returned when the request body is malformed (for example, the `pid` parameter is missing) or the project is disabled.### 402 Payment Required+This error is usually returned when the project is not active (i.e. the subscription has expired or the quota has been exceeded). Please go to the [Billing](https://swetrix.com/billing) page to check the current status and usage of your subscription.### 403 Forbidden+This error is usually returned when the `unique` parameter is set to `true` and the event is not unique, i.e. the pageview event has already been recorded for this session.### 500 Internal Server Error+This error is usually returned when the server is unable to process the request due to a temporary problem (for example, the database is unavailable).If you receive this error, please try again later. If the problem persists, please [contact us](https://swetrix.com/contact).## API wrappers+### NodeJS+Currently we provide an official NodeJS API wrapper for the events API.You can find how to install and use it by opening its [npm package page](https://www.npmjs.com/package/@swetrix/node).### Contributing+We welcome any countributions to Swetrix. If you want to create your own API wrapper, feel free to do so. Please [contact us](https://swetrix.com/contact) and we will list your library here.Also as an example, feel free to check out the [source code](https://github.com/swetrix/swetrix-node) of our NodeJS API wrapper.@@ -183,6 +209,7 @@ Also as an example, feel free to check out the [source code](https://github.com/## Common request examples### Recording a pageview event using JavaScript fetch API+```javascriptfetch('https://api.swetrix.com/log', {method: 'POST',@@ -202,6 +229,7 @@ fetch('https://api.swetrix.com/log', {```### Recording a custom event using Go net/http+```gopackage main@@ -240,6 +268,7 @@ func main() {```### Recording a heartbeat event using PHP cURL+```php$ch = curl_init();diff --git a/docs/api/stats.md b/docs/api/stats.mdindex a464a1a97..d6b0b9a01 100644--- a/docs/api/stats.md+++ b/docs/api/stats.md@@ -11,13 +11,16 @@ Each request must be authenticated with an API key using `X-Api-Key` HTTP headerRate limit for the API depends on your plan, you can find more information on the billing (or the main) page.As of 9 February 2023, the rate limits are as follows:+- **Free plan**: 600 requests per hour;- **Any paid plan**: 600 requests per hour.If you have special needs for more requests, please contact us to request more capacity.## Concepts+### Time buckets+- **minute** - 1 minute;- **hour** - 1 hour;- **day** - 1 day;@@ -26,6 +29,7 @@ If you have special needs for more requests, please contact us to request more c- **year** - 1 year.### Periods+- **today** - today (i.e. the time starting from 12:00 AM of the current day);- **yesterday** - yesterday (i.e. the time starting from 12:00 AM of the previous day);- **1d** - last 24 hours;@@ -41,17 +45,21 @@ If you have special needs for more requests, please contact us to request more c:::### Measures+Measures are an aggregate functions that are used for performance-related endpoints. They allow you to select a function that will be used for aggregation of your metrics.It supports the following values:+1. `median` (default) - the middle value of a set of numbers (i.e. 50th percentile).2. `average` - the arithmetic mean value.3. `p95` - the 95th quantile.4. `quantiles` - it's a special measure, because instead of the regular metrics (e.g. `dns`, `tls`, etc.) it will return load time (the sum on all metrics) across 3 qunatiles: `p50`, `p75` and `p95`.### Filters+Filters are used to aggregate data by specific parameters. For example, you can filter the data by country, browser, operating system, etc.'Filter' is an object with the following structure:+```json{"column": "cc",@@ -65,15 +73,19 @@ Filters are used to aggregate data by specific parameters. For example, you can- **isExclusive** - whether to include or exclude the specified value. If `isExclusive` is `true`, the data will be filtered by the specified value. If `isExclusive` is `false`, the data will be filtered by all values except the specified one.### Mode+The mode parameter specifies how the data is aggregated. Possible values are:+- **periodic** - data is aggregated by the specified time bucket (e.g. by day, week, etc.);- **cumulative** - data is aggregated cumulatively (e.g. the number of visits for the current day is the sum of the number of visits for all previous days and the current day).### Metrics+Metrics are a set of rules that allow you to aggregate your custom events as decimals or integers. They're extremely useful for e-commerce platforms, allowing you to calculate your sales, for example.This parameter is only supported for [traffic analytics](#get-v1log) endpoint.'Metric' is an object with the following structure:+```json{"customEventName": "sale",@@ -85,6 +97,7 @@ This parameter is only supported for [traffic analytics](#get-v1log) endpoint.```Where:+1. `customEventName` (required): is the name of the custom event you want to apply your metric to.2. `metaKey` (optional): Custom event metadata key to filter (for example, "currency").3. `metaValue` (optional): Custom event metadata value to filter (for example, "GBP").@@ -92,7 +105,9 @@ Where:5. `metaValueType` (required): Specifies how to interpret the custom metric value. For example, `float` will convert "15.99" to 15.99, while `integer` will interpret it as 15. (supported values are: `integer`, `float`. If set to `string`, the whole metric will be ignored.)## Endpoints+### GET /v1/log+This endpoint returns the aggregated traffic data for your project. This is the exact same data you see in the Traffic tab of your Dashboard, but represented as a JSON entity.```bash@@ -200,17 +215,18 @@ curl 'https://api.swetrix.com/v1/log?pid=YOUR_PROJECT_ID&timeBucket=day&period=7},"chart": {"x": [- "2023-02-02 00:00:00", "2023-02-03 00:00:00", "2023-02-04 00:00:00", "2023-02-05 00:00:00", "2023-02-06 00:00:00", "2023-02-07 00:00:00", "2023-02-08 00:00:00", "2023-02-09 00:00:00"- ],- "visits": [- 0, 2, 9, 12, 4, 7, 4, 0+ "2023-02-02 00:00:00",+ "2023-02-03 00:00:00",+ "2023-02-04 00:00:00",+ "2023-02-05 00:00:00",+ "2023-02-06 00:00:00",+ "2023-02-07 00:00:00",+ "2023-02-08 00:00:00",+ "2023-02-09 00:00:00"],- "uniques": [- 0, 2, 9, 10, 4, 7, 4, 0- ],- "sdur": [- 0, 54, 2, 126, 8, 8, 2- ]+ "visits": [0, 2, 9, 12, 4, 7, 4, 0],+ "uniques": [0, 2, 9, 10, 4, 7, 4, 0],+ "sdur": [0, 54, 2, 126, 8, 8, 2]},"customs": {"sale": 16,@@ -224,50 +240,59 @@ curl 'https://api.swetrix.com/v1/log?pid=YOUR_PROJECT_ID&timeBucket=day&period=7```#### Parameters+<hr />**pid** (required)The project ID.+<hr />**timeBucket** (required)See [time buckets](#time-buckets).+<hr />**period** (required)See [periods](#periods).+<hr />**from** / **to**Instead of specifying a fixed period, you can specify a custom time range using `from` and `to` parameters. Both parameters are optional, but if you specify `from`, you must also specify `to`. The format is `YYYY-MM-DD`.+<hr />**timezone**The timezone to use for the time range. The default is `Etc/GMT`. You can use any timezone supported by [day.js](https://day.js.org/docs/en/timezone/timezone/) library.+<hr />**filters**An array of [filter objects](#filters).+<hr />**mode**[Mode](#mode) used to aggregate the data. The default is `periodic`.+<hr />**metrics**An optional array of [metric objects](#metrics), with up to 3 metrics allowed. If the `metrics` array is provided and it's valid, it will be calculated on the backend and an additional field called `meta` will be returned in the response.-The `filters` and `timezone` parameters provided within the same request are also used when calculating custom metrics.+The `filters` and `timezone` parameters provided within the same request are also used when calculating custom metrics.The `meta` is an array of objects like:+```javascript{"key": "amount", // equals to "metricKey" provided@@ -281,6 +306,7 @@ The `meta` is an array of objects like:},}```+<hr />### GET /v1/log/performance@@ -293,6 +319,7 @@ The `chart` object contains performance metrics represented as an array of valueThe metric values are in seconds.The metrics are:+- `dns` - DNS Resolution time;- `tls` - TLS Setup time;- `conn` - Connection time;@@ -366,36 +393,31 @@ curl 'https://api.swetrix.com/v1/log/performance?pid=YOUR_PROJECT_ID&timeBucket=},"chart": {"x": [- "2023-02-02 00:00:00", "2023-02-03 00:00:00", "2023-02-04 00:00:00", "2023-02-05 00:00:00", "2023-02-06 00:00:00", "2023-02-07 00:00:00", "2023-02-08 00:00:00", "2023-02-09 00:00:00"- ],- "dns": [- 0, 0, 0.09, 0.05, 0.02, 0.05, 0.06, 0- ],- "tls": [- 0, 0.13, 0.06, 0.06, 0.07, 0.33, 0.34, 0- ],- "conn": [- 0, 0, 0.04, 0.03, 0.01, 0.02, 0.02, 0- ],- "response": [- 0, 0.01, 0, 0, 0, 0.37, 0, 0+ "2023-02-02 00:00:00",+ "2023-02-03 00:00:00",+ "2023-02-04 00:00:00",+ "2023-02-05 00:00:00",+ "2023-02-06 00:00:00",+ "2023-02-07 00:00:00",+ "2023-02-08 00:00:00",+ "2023-02-09 00:00:00"],- "render": [- 0, 0.01, 0.38, 0.17, 0.63, 0.07, 0.07, 0- ],- "domLoad": [- 0, 0.91, 0.48, 0.54, 0.69, 0.94, 1.22, 0- ],- "ttfb": [- 0, 0.06, 0.07, 0.07, 0.05, 0.1, 1.11, 0- ]+ "dns": [0, 0, 0.09, 0.05, 0.02, 0.05, 0.06, 0],+ "tls": [0, 0.13, 0.06, 0.06, 0.07, 0.33, 0.34, 0],+ "conn": [0, 0, 0.04, 0.03, 0.01, 0.02, 0.02, 0],+ "response": [0, 0.01, 0, 0, 0, 0.37, 0, 0],+ "render": [0, 0.01, 0.38, 0.17, 0.63, 0.07, 0.07, 0],+ "domLoad": [0, 0.91, 0.48, 0.54, 0.69, 0.94, 1.22, 0],+ "ttfb": [0, 0.06, 0.07, 0.07, 0.05, 0.1, 1.11, 0]},"appliedFilters": []}```### GET /v1/log/birdseye+This endpoint returns a summary of the log data for the specified projects. The response is an object with project IDs as keys and objects with the following properties as values:+```typescript{current: { // data for the selected period@@ -446,11 +468,13 @@ curl 'https://api.swetrix.com/v1/log/birdseye?pids=["YOUR_PROJECT_ID"]&period=7d```#### Parameters+<hr />**pids** (required)An array of project IDs to return summary data for.+<hr />**pid**@@ -462,26 +486,32 @@ A single project ID to return summary data for. You can use either `pids` or `pi**period** (required)See [periods](#periods).+<hr />**from** / **to**Instead of specifying a fixed period, you can specify a custom time range using `from` and `to` parameters. Both parameters are optional, but if you specify `from`, you must also specify `to`. The format is `YYYY-MM-DD`.+<hr />**timezone**The timezone to use for the time range. The default is `Etc/GMT`. You can use any timezone supported by [day.js](https://day.js.org/docs/en/timezone/timezone/) library.+<hr />**filters**An array of [filter objects](#filters).+<hr />### GET /v1/log/performance/birdseye+This endpoint returns a summary of the performance data for the specified projects. This endpoint also accepts [measures](#measures) parameter.The response is an object with project IDs as keys and objects with the following properties as values:+```typescript{current: { // data for the selected period@@ -526,10 +556,13 @@ curl 'https://api.swetrix.com/v1/log/performance/birdseye?pids=["YOUR_PROJECT_ID```#### Parameters+Accepts the same parameters as the [`/log/birdseye` endpoint](#get-v1logbirdseye).### GET /v1/log/captcha/birdseye+This endpoint returns a summary of the CAPTCHA data for the specified projects. The response is an object with project IDs as keys and objects with the following properties as values:+```typescript{current: { // data for the selected period@@ -562,6 +595,7 @@ curl 'https://api.swetrix.com/v1/log/captcha/birdseye?pids=["YOUR_PROJECT_ID"]&p```#### Parameters+Accepts the same parameters as the [`/log/birdseye` endpoint](#get-v1logbirdseye).### GET /v1/log/live-visitors@@ -593,11 +627,13 @@ curl 'https://api.swetrix.com/v1/log/live-visitors?pid=YOUR_PROJECT_ID'\```#### Parameters+<hr />**pid** (required)The project ID to return live visitors for.+<hr />### GET /v1/log/hb@@ -616,19 +652,23 @@ curl 'https://api.swetrix.com/log/hb?pids=["YOUR_PROJECT_ID"]'\```#### Parameters+<hr />**pids** (required)An array of project IDs to return heartbeat events for.+<hr />**pid**A single project ID to return heartbeat events for. You can use either `pids` or `pid` parameter, but not both.+<hr />### GET /v1/log/meta+This endpoint returns an array of custom event metadata.```bash@@ -660,14 +700,15 @@ curl 'https://api.swetrix.com/v1/log/meta?pid=YOUR_PROJECT_ID&timeBucket=day&per```#### Parameters+The parameters are the same as for the [`/log` endpoint](#get-v1log), except additionally you must pass the following:**event**The name of the custom event to return metadata for.-### GET /v1/log/property+This endpoint returns an array of page tags for a particular custom property. For example, if you have a blog, you may want to pass some properties, such as "author", to our API along with your pageviews. The 'author' property can have multiple values, such as 'John', 'Tom' or 'Andrew'. You can then aggregate on these properties.```bash@@ -699,6 +740,7 @@ curl 'https://api.swetrix.com/v1/log/property?pid=YOUR_PROJECT_ID&timeBucket=day```#### Parameters+The parameters are the same as for the [`/log` endpoint](#get-v1log), except additionally you must pass the following:**property**@@ -706,6 +748,7 @@ The parameters are the same as for the [`/log` endpoint](#get-v1log), except addThe name of the property (tag) to return details for.### GET /v1/log/sessions+This endpoint returns an array of individual sessions.```bash@@ -763,26 +806,31 @@ curl 'https://api.swetrix.com/v1/log/sessions?pid=YOUR_PROJECT_ID&period=7d&take**pid** (required)The project ID.+<hr />**period** (required)See [periods](#periods).+<hr />**from** / **to**Instead of specifying a fixed period, you can specify a custom time range using `from` and `to` parameters. Both parameters are optional, but if you specify `from`, you must also specify `to`. The format is `YYYY-MM-DD`.+<hr />**timezone**The timezone to use for the time range. The default is `Etc/GMT`. You can use any timezone supported by [day.js](https://day.js.org/docs/en/timezone/timezone/) library.+<hr />**filters**An array of [filter objects](#filters).+<hr />**take**@@ -797,8 +845,8 @@ The number of sessions to skip. The default is `0`.<hr />-### GET /v1/log/session+This endpoint returns information about a single session.```bash@@ -881,14 +929,7 @@ curl 'https://api.swetrix.com/v1/log/session?pid=YOUR_PROJECT_ID&psid=SESSION_ID"2023-12-20 16:57:00","2023-12-20 16:58:00"],- "visits": [- 1,- 0,- 1,- 1,- 1,- 0- ]+ "visits": [1, 0, 1, 1, 1, 0]},"timeBucket": "minute"}@@ -901,6 +942,7 @@ curl 'https://api.swetrix.com/v1/log/session?pid=YOUR_PROJECT_ID&psid=SESSION_ID**pid** (required)The project ID.+<hr />**psid** (required)@@ -912,8 +954,8 @@ The session identifier.**timezone**The timezone to use for the time range. The default is `Etc/GMT`. You can use any timezone supported by [day.js](https://day.js.org/docs/en/timezone/timezone/) library.-<hr />+<hr />## Common request examples@@ -1010,21 +1052,24 @@ curl 'https://api.swetrix.com/log?pid=YOUR_PROJECT_ID&timeBucket=day&period=7d&f},"chart": {"x": [- "2023-02-02 00:00:00", "2023-02-03 00:00:00", "2023-02-04 00:00:00", "2023-02-05 00:00:00", "2023-02-06 00:00:00", "2023-02-07 00:00:00", "2023-02-08 00:00:00", "2023-02-09 00:00:00"- ],- "visits": [- 73, 55, 21, 13, 21, 11, 98, 1+ "2023-02-02 00:00:00",+ "2023-02-03 00:00:00",+ "2023-02-04 00:00:00",+ "2023-02-05 00:00:00",+ "2023-02-06 00:00:00",+ "2023-02-07 00:00:00",+ "2023-02-08 00:00:00",+ "2023-02-09 00:00:00"],- "uniques": [- 73, 55, 21, 13, 21, 11, 98, 1- ],- "sdur": [- 43, 28, 29, 36, 50, 51, 52, 2- ]+ "visits": [73, 55, 21, 13, 21, 11, 98, 1],+ "uniques": [73, 55, 21, 13, 21, 11, 98, 1],+ "sdur": [43, 28, 29, 36, 50, 51, 52, 2]},"avgSdur": 43,"customs": {- "SIGNUP": 7, "PROJECT_CREATED": 14, "ACCOUNT_DELETED": 2+ "SIGNUP": 7,+ "PROJECT_CREATED": 14,+ "ACCOUNT_DELETED": 2},"appliedFilters": [{ "column": "cc", "filter": "GB", "isExclusive": false },@@ -1032,4 +1077,3 @@ curl 'https://api.swetrix.com/log?pid=YOUR_PROJECT_ID&timeBucket=day&period=7d&f]}```-diff --git a/docs/billing/exceeding-plan-limits.md b/docs/billing/exceeding-plan-limits.mdindex 889ca99c1..63da16e72 100644--- a/docs/billing/exceeding-plan-limits.md+++ b/docs/billing/exceeding-plan-limits.md@@ -8,8 +8,9 @@ First of all, we don't stop collecting traffic or charge extra if you have an ocIf you exceed your subscription plan, we won't automatically upgrade you to the next one because it's unethical.We may block your dashboard if:- - You exceed your subscription plan for two consecutive months, or- - You exceed your event quota by more than 30%.++- You exceed your subscription plan for two consecutive months, or+- You exceed your event quota by more than 30%.If this happens, we will not lock your dashboard immediately. Instead, we will give you 7 days notice that your traffic has exceeded your subscription tier and provide you with information on how to resolve the issue.diff --git a/docs/billing/faq.md b/docs/billing/faq.mdindex 9ebd9b5c9..d30a06b74 100644--- a/docs/billing/faq.md+++ b/docs/billing/faq.md@@ -6,11 +6,13 @@ slug: /billing-faqimport useBaseUrl from '@docusaurus/useBaseUrl';## How does billing work?+If you subscribe to a monthly plan, you will be billed the same amount on the same day (unless you upgrade or downgrade your plan). For example, if you subscribe on the 15th of July, you will be billed on the 15th of each subsequent month.If you have an annual plan, you will be billed on the same day each year.## Will I be billed per account or per website?+TLDR: We charge per account.Our subscription tiers are based on the total number of page views, custom events (and other events such as CAPTCHA) of all the projects you create on our account, so you can add as many sites to Swetrix as you like, the total number of events across all of them will count as your total number of events towards your subscription tier.@@ -18,25 +20,30 @@ Our subscription tiers are based on the total number of page views, custom eventAll our subscription plans include up to 50 projects for free, for each additional project you will be charged $0.15 per project.## How do I access my invoices?+We use Paddle as our payment processor, which sends invoices by email, with a copy in the body of the email and a link to view the invoice on a hosted website.## Can I switch between monthly and yearly billing?+You can switch between monthly and annual billing at any time. For example, if you are halfway through your annual subscription and decide to switch to a monthly subscription, the price will be prorated to reflect what you have already paid.## What payment methods does Swetrix accept?+We accept credit/debit cards, PayPal, Google Pay and Apple Pay. All payments are processed securely through Paddle.## Can I get a VAT refund on my subscription?+You can add your company details and VAT ID when subscribing to one of our plans. If you're eligible, no VAT or other sales taxes will be added to your subscription price.<img alt="Add VAT on checkout" src={useBaseUrl('img/billing/checkout_add_vat.png')} /><br /><br />-You can also add your VAT number after you created a subscription, to do that open the invoice Paddle sent you to your email address, and click on the "Add address & VAT Number" button.+You can also add your VAT number after you created a subscription, to do that open the invoice Paddle sent you to your email address, and click on the "Add address & VAT Number" button.<img alt="Add VAT on existing invoice" src={useBaseUrl('img/billing/invoice_add_vat.png')} />## I am seeing "Unable to validate VAT number" error when adding my VAT number+If your VAT number has a country code prefix in it (e.g. "DE" in "DE123456789"), please remove it and try entering only the numbers.The reason for this is that you are selecting the country code from the list of countries below, so the VAT number is validated separately. Our payment processor Paddle handles the VAT processing. Here is [a list of VAT numbers formats](https://www.paddle.com/help/sell/tax/what-format-should-i-use-for-my-vat-id) accepted by Paddle.@@ -47,4 +54,5 @@ The reason for this is that you are selecting the country code from the list ofIf you are still having this issue, please [contact us](https://swetrix.com/contact).## How can I update my payment information?+To update your billing information, log in to your account and go to the [Billing](https://swetrix.com/billing) page.There you will find an "Update payment details" button which will take you to the Paddle subscription management page where you can edit your payment details.diff --git a/docs/billing/upgrade-from-trial.md b/docs/billing/upgrade-from-trial.mdindex 0265d4a49..b65ccd663 100644--- a/docs/billing/upgrade-from-trial.md+++ b/docs/billing/upgrade-from-trial.md@@ -9,7 +9,6 @@ At any time during your trial, or once it's over, you can upgrade to a paid subsWe do not stop collection or reset your collected data. The analytics data is preserved when you update from a trial to a paid plan, or change your paid subscription to another plan.-## Updating to a paid subscriptionTo update to a paid plan, you need to log in to your account and go to the [billing page](https://swetrix.com/billing).@@ -42,8 +41,8 @@ You can add your company details and VAT ID when subscribing to one of our plans<img alt="Add VAT on existing invoice" src={useBaseUrl('img/billing/invoice_add_vat.png')} />-You can also add your VAT number after you created a subscription, to do that open the invoice Paddle sent you to your email address, and click on the "Add address & VAT Number" button.+You can also add your VAT number after you created a subscription, to do that open the invoice Paddle sent you to your email address, and click on the "Add address & VAT Number" button.<img alt="Add VAT on existing invoice" src={useBaseUrl('img/billing/invoice_add_vat.png')} />-To learn more about billing, visit our [billing FAQ page].\ No newline at end of file+To learn more about billing, visit our [billing FAQ page].diff --git a/docs/captcha/client-side-usage.md b/docs/captcha/client-side-usage.mdindex 69d6ecc26..807438e49 100644--- a/docs/captcha/client-side-usage.md+++ b/docs/captcha/client-side-usage.md@@ -10,6 +10,7 @@ You can use the CAPTCHA widget on any page of your website by using our CAPTCHA## Installation### Using CDN+The easiest way to add the CAPTCHA script to your website is to edit the HTML code of your website. To do this, paste the following code snippet into the header section (`<head>` tag) of your website:```html@@ -17,9 +18,11 @@ The easiest way to add the CAPTCHA script to your website is to edit the HTML co```### Using NPM-__Not yet supported__++**Not yet supported**## Usage+Once the CAPTCHA script is installed (or embedded) on your website, you can use the CAPTCHA widget by adding the following HTML code to your page:```html@@ -31,20 +34,22 @@ Inside the `.swecaptcha` element, the widget will automatically render a frame wAfter the CAPTCHA loader script is loaded, it will add a `window.swetrixCaptchaForceLoad` function to the global scope. You can use this function to forcefully reload the CAPTCHA widget. This function can be useful if you changed the CAPTCHA configuration and want to reload the widget without reloading the page.### Customisation+You can customise the appearance of the CAPTCHA widget by adding the following attributes to the `.swecaptcha` element:-| Attribute | Type | Description |-| --- | --- | --- |-| `data-project-id` | string | The ID of your CAPTCHA project (REQUIRED). |-| `data-theme` | string | The theme of the CAPTCHA widget. Possible values: `light` (default), `dark`. |-| `data-response-input-name` | string | Name of the token input element. Default: `swetrix-captcha-response`. |+| Attribute | Type | Description |+| -------------------------- | ------ | ---------------------------------------------------------------------------- |+| `data-project-id` | string | The ID of your CAPTCHA project (REQUIRED). |+| `data-theme` | string | The theme of the CAPTCHA widget. Possible values: `light` (default), `dark`. |+| `data-response-input-name` | string | Name of the token input element. Default: `swetrix-captcha-response`. |### Widget sizes+The CAPTCHA widget has several sizes based on the state of the CAPTCHA challenge and the widget will automatically adjust its size.Here's a table with the possible sizes of the widget that can help you when designing your website:-| State | Width | Height |-| --- | --- | --- |-| Default | 300px | 66px |-| Manual challenge | 300px | 200px |+| State | Width | Height |+| ---------------- | ----- | ------ |+| Default | 300px | 66px |+| Manual challenge | 300px | 200px |diff --git a/docs/captcha/server-side-validation.md b/docs/captcha/server-side-validation.mdindex 2b501a03f..b67ea46f9 100644--- a/docs/captcha/server-side-validation.md+++ b/docs/captcha/server-side-validation.md@@ -17,20 +17,20 @@ Token validation can only be performed once, if you try to validate the same tokTo validate the token, you have to send a POST request to the `https://api.swetrix.com/v1/captcha/validate` URL, with the following parameters:-| Parameter | Type | Description |-| --- | --- | --- |-| token | string | The token returned by the CAPTCHA widget. |-| secret | string | Your CAPTCHA project secret key. |+| Parameter | Type | Description |+| --------- | ------ | ----------------------------------------- |+| token | string | The token returned by the CAPTCHA widget. |+| secret | string | Your CAPTCHA project secret key. |<br />The successful response will have the `success` field set to `true` and the `data` field will contain the following fields:-| Field | Type | Description |-| --- | --- | --- |-| hash | string | The hash of CAPTCHA user passed. |+| Field | Type | Description |+| --------- | ------ | ------------------------------------- |+| hash | string | The hash of CAPTCHA user passed. || timestamp | number | The timestamp of CAPTCHA user passed. |-| pid | string | The ID of the CAPTCHA project. |+| pid | string | The ID of the CAPTCHA project. |```json{@@ -46,6 +46,7 @@ The successful response will have the `success` field set to `true` and the `dat<br />The failed response will throw an error that will look like the following example. The HTTP status code will correspond to the `statusCode` in JSON.+```json{"statusCode": 400,@@ -72,25 +73,23 @@ You can use the [@swetrix/captcha-validator](https://www.npmjs.com/package/@swetYou can use this package in your Node.js (or NestJS, ExpressJS, etc.) project to validate the user's response to the CAPTCHA.The package exports a single function `validateToken` which takes arguments listed below and returns a Promise.-| Argument | Type | Description | Required |-| --- | --- | --- | --- |-| token | string | The token returned by the CAPTCHA widget. | YES |-| secretKey | string | Your CAPTCHA project secret key. | YES |-| apiURL | string | The API URL to use (default: https://api.swetrix.com/captcha), this one may be used in case you're selfhosting the API. | NO |+| Argument | Type | Description | Required |+| --------- | ------ | ----------------------------------------------------------------------------------------------------------------------- | -------- |+| token | string | The token returned by the CAPTCHA widget. | YES |+| secretKey | string | Your CAPTCHA project secret key. | YES |+| apiURL | string | The API URL to use (default: https://api.swetrix.com/captcha), this one may be used in case you're selfhosting the API. | NO |<br />Here's an example of how to use the package in your project:+```jsconst { validateToken } = require('@swetrix/captcha-validator')// orimport { validateToken } from '@swetrix/captcha-validator'// somewhere inside the controller of your form where the CAPTCHA is used-validateToken(- 'CAPTCHA_TOKEN',- 'YOUR_SECRET_KEY',-).then((result) => {+validateToken('CAPTCHA_TOKEN', 'YOUR_SECRET_KEY').then((result) => {const [status, data] = result// status is a boolean, true if the token is valid, false otherwise// data is an error message if status is falsediff --git a/docs/captcha/testing.md b/docs/captcha/testing.mdindex e79aaad4a..c6af31a28 100644--- a/docs/captcha/testing.md+++ b/docs/captcha/testing.md@@ -4,18 +4,20 @@ slug: /captcha/testing---## Dummy project IDs+You can use the following project IDs for testing.-| Project ID | Description |-|------------|-------------|+| Project ID | Description |+| --------------- | ---------------------------------------------------------------------------- || `AP00000000000` | Always pass captcha regardless of what was entered in challenge input field. |-| `FAIL000000000` | Always fail captcha. |+| `FAIL000000000` | Always fail captcha. |## Dummy secret keys+You can use the following secret keys for testing.-| Secret Key | Description |-|------------|-------------|-| `PASS000000000000000000` | Always successfully validate captcha. |-| `FAIL000000000000000000` | Always fail to validate captcha. |+| Secret Key | Description |+| ------------------------ | --------------------------------------------------------- |+| `PASS000000000000000000` | Always successfully validate captcha. |+| `FAIL000000000000000000` | Always fail to validate captcha. || `USED000000000000000000` | Always fail to validate captcha because it has been used. |diff --git a/docs/contribute/how-to.md b/docs/contribute/how-to.mdindex 14520f32e..81ac9265a 100644--- a/docs/contribute/how-to.md+++ b/docs/contribute/how-to.md@@ -7,7 +7,8 @@ We are very grateful to everyone who contributes to the project, whether it's aThank you for your support!Here are some ways you can contribute to the project:- - [Tweet](https://twitter.com/swetrix) about us, mention us in your blog posts or share your opinion about Swetrix in any other way. We can only grow thanks to your feedback and reviews.- - Help us with the development of Swetrix. All our source codes are available on [GitHub](https://github.com/swetrix), we also have an open roadmap filled with tasks [there](https://github.com/orgs/Swetrix/projects/2).- - Contribute by translating Swetrix into the language you know. We use [Crowdin](https://crowdin.com/project/swetrix) to manage translations. All translations are provided by the community, thanks for your help!- - Report a bug to [Report](https://github.com/Swetrix/roadmap/issues) or make a feature request on our Github issues page. We are always open to your ideas and suggestions.++- [Tweet](https://twitter.com/swetrix) about us, mention us in your blog posts or share your opinion about Swetrix in any other way. We can only grow thanks to your feedback and reviews.+- Help us with the development of Swetrix. All our source codes are available on [GitHub](https://github.com/swetrix), we also have an open roadmap filled with tasks [there](https://github.com/orgs/Swetrix/projects/2).+- Contribute by translating Swetrix into the language you know. We use [Crowdin](https://crowdin.com/project/swetrix) to manage translations. All translations are provided by the community, thanks for your help!+- Report a bug to [Report](https://github.com/Swetrix/roadmap/issues) or make a feature request on our Github issues page. We are always open to your ideas and suggestions.diff --git a/docs/ext-sdk-faq.md b/docs/ext-sdk-faq.mdindex f5987dab2..63065f557 100644--- a/docs/ext-sdk-faq.md+++ b/docs/ext-sdk-faq.md@@ -4,6 +4,7 @@ slug: /sdk-faq---## How to test an extension?+So, you have written your custom extension and want to test it. Cool!At the moment, the marketplace and extensions are in beta, so for now we provide 1 way to test your extensions: to do so, you need to download and locally run the [Swetrix frontend repository](https://github.com/Swetrix/swetrix-fe).@@ -11,6 +12,7 @@ At the moment, the marketplace and extensions are in beta, so for now we provideOnce you've got it up and running, you can drop your extension into the public/assets directory, then manually add a link to your extension in the `src/pages/Project/View/ViewProject.jsx` file.The result should be something like this:+```javascript// this useEffect hook is located around line 300 in ViewProject.jsxuseEffect(() => {@@ -29,4 +31,5 @@ We are currently working on draft extensions so you can upload your beta extensiAs soon as this functionality is implemented, we will update this section of the documentation.## How to publish an extension?+The publishing process is still in development, but we are working on it and will update this section of the documentation as soon as it is ready.diff --git a/docs/ext-sdk-introduction.md b/docs/ext-sdk-introduction.mdindex cc4f02988..93313b4e4 100644--- a/docs/ext-sdk-introduction.md+++ b/docs/ext-sdk-introduction.md@@ -4,6 +4,7 @@ slug: /sdk-introduction---## What are the extensions?+Swetrix allows you to create your own extensions to extend the functionality of the platform.These extensions work similarly to browser extensions and allow you to access and process analytics data, display customised pages and much more.@@ -14,6 +15,7 @@ Swetrix Marketplace and the extensions SDK are still in development, the documen:::## How do they work?+Extensions can communicate with the Swetrix platform via the Swetrix SDK.The Swetrix SDK is a module that gives you the ability to configure different event listeners and also to transfer data from the extension to the Swetrix dashboard.All user-installed extensions run in parallel and are isolated from each other.@@ -23,10 +25,11 @@ The extension itself is a JavaScript file which consists of a function that takeThis object consists of all the APIs you can use when writing your extension.A simple example of an extension structure:+```javascript-(async (sdk) => {+;async (sdk) => {// Your extension code goes here..-})+}```You can find full and in-detail explained examples in our [GitHub repository](https://github.com/Swetrix/extension-examples).diff --git a/docs/ext-sdk-reference.md b/docs/ext-sdk-reference.mdindex 561085fe1..49f9f333a 100644--- a/docs/ext-sdk-reference.md+++ b/docs/ext-sdk-reference.md@@ -4,42 +4,49 @@ slug: /sdk-reference---## Event listeners+Event listeners allow you to listen to the specific events from the Swetrix Dashboard and run your custom code based on it.The method `addEventListener` works by adding a function to the list of event listeners for the specified event type on which it's called.If the function or object is already in the list of event listeners for this target, the function or object is not added a second time.Here is a basic example of an event listener:+```javascript-(async (sdk) => {+;async (sdk) => {sdk.addEventListener('projectinfo', ({ id }) => {// Your code goes here..})-})+}```Currently, the following events are available:+1. `load` - The event is triggered when the dashboard loads a new set of analytics data. For example, when user opens dashboard for the first time, changes the data range or time bucket.2. `timeupdate` - This event is triggered when user changes the time bucket, time perios or sets the date range.3. `filtersupdate` - This event is triggered when user changes the filters.4. `projectinfo` - This event is triggered on load and it supplies information about the project it's running on.## addExportDataRow()+The `addExportDataRow` function adds a new export data row into the 'Export data' dropdown.The function takes 2 parameters:+1. The name of the row.2. The callback which is called when the user clicks on the row.Here is an example of how to use this function:+```javascript-(async (sdk) => {+;async (sdk) => {sdk.addExportDataRow('As JSON', () => {// Your code goes here..})-})+}```## removeExportDataRow()+The `removeExportDataRow` function removes an export data row from the dropdown. It takes the name of the export data row as a parameter.```javascript@@ -54,6 +61,7 @@ For example, Swetrix has a Country panel with 2 pre-built tabs: countries list aBy using this method, you can add a custom tab with a custom HTML (or just text) content.This function takes 3 parameters:+1. Panel ID - the ID of the panel where you want to add a new tab.2. The content of your tab, can be either text or stringified HTML.3. `onOpen` callback - a callback that is called when the user opens the tab.@@ -66,6 +74,7 @@ sdk.addPanelTab('cc', '<h2>Custom Content</h2>', () => {```Currently, Swetrix supports the following panels you can inject a tab into:+1. `cc` - Country2. `pg` - Page3. `lc` - Locale@@ -83,4 +92,4 @@ The `removePanelTab` function allows you to remove a panel tab from the dashboar```javascriptsdk.removePanelTab('cc')-```\ No newline at end of file+```diff --git a/docs/integration-guides.md b/docs/integration-guides.mdindex b252684dc..b2b4ae782 100644--- a/docs/integration-guides.md+++ b/docs/integration-guides.md@@ -8,6 +8,7 @@ Sometimes it might be easier to install Swetrix without editing the HTML code ofWe support a variety of different integrations you can use.## Official integrations+1. [NPM package for JavaScript](/install-script#install-swetrix-via-npm)2. [WordPress](/wordpress-integration)3. [Wix](/wix-integration)@@ -21,6 +22,7 @@ We support a variety of different integrations you can use.11. [HTML script integration](/install-script#edit-the-websites-html-code)## Unofficial integrations+1. [Java SDK](https://github.com/Casterlabs/swetrix-java)2. [Vue](https://github.com/ansidev/swetrix-vue)diff --git a/docs/integrations/django.md b/docs/integrations/django.mdindex 4b1aebaa0..dcf855398 100644--- a/docs/integrations/django.md+++ b/docs/integrations/django.md@@ -6,12 +6,16 @@ slug: /django-integrationAfter you sign up on Swetrix and create a new project, the only thing left is to add it to your website.## Installation+1. Go to your Django website codebase and open up the .html templates folder. You need to add the Swetrix tracking script to the base template which is imported by all other templates via `{% extends 'base.html' %}`.2. In the HTML `<head>` section you need to add the following:+```html<script src="https://swetrix.org/swetrix.js" defer></script>```+3. In the `<body>` section you need to add the following:+```html<script>document.addEventListener('DOMContentLoaded', function () {@@ -21,7 +25,11 @@ After you sign up on Swetrix and create a new project, the only thing left is to</script><noscript>- <img src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID" alt="" referrerpolicy="no-referrer-when-downgrade" />+ <img+ src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID"+ alt=""+ referrerpolicy="no-referrer-when-downgrade"+ /></noscript>```@@ -30,6 +38,7 @@ It's very important not to forget to replace `YOUR_PROJECT_ID` with your actual:::## Check your installation+After installing Swetrix tracking script, go to your website and visit some pages.Within a minute you should be able to see new pageviews being added to your project's dahsboard.diff --git a/docs/integrations/docusaurus.md b/docs/integrations/docusaurus.mdindex 4225caf23..0e54d3f83 100644--- a/docs/integrations/docusaurus.md+++ b/docs/integrations/docusaurus.md@@ -6,6 +6,7 @@ slug: /docusaurus-integrationAfter you sign up on Swetrix and create a new project, the only thing left is to add it to your website.## Installation+1. Open your Docusaurus project.2. Edit the `docusaurus.config.js` file and add the following inside `module.exports`:@@ -34,6 +35,7 @@ It's very important not to forget to replace `YOUR_PROJECT_ID` with your actual:::## Check your installation+After installing Swetrix tracking script, go to your website and visit some pages.Within a minute you should be able to see new pageviews being added to your project's dahsboard.diff --git a/docs/integrations/framer.md b/docs/integrations/framer.mdindex 81b543a1d..4b6a3450a 100644--- a/docs/integrations/framer.md+++ b/docs/integrations/framer.md@@ -8,22 +8,23 @@ import useBaseUrl from '@docusaurus/useBaseUrl';After you sign up on Swetrix and create a new project, the only thing left is to add it to your website.## Installation+1. Log in to your [Framer](https://www.framer.com) account.-2. In the dashboard, click on the website you want to add Swetrix to:-<img alt="Framer Dashboard" src={useBaseUrl('img/framer-1.png')} />+ <img alt="Framer Dashboard" src={useBaseUrl('img/framer-1.png')} />3. Open the website settings:-<img alt="Framer Website page" src={useBaseUrl('img/framer-2.png')} />+ <img alt="Framer Website page" src={useBaseUrl('img/framer-2.png')} />4. Scroll down to the `Custom Code` section:-<img alt="Framer Website page" src={useBaseUrl('img/framer-3.png')} />+ <img alt="Framer Website page" src={useBaseUrl('img/framer-3.png')} />5. Add the following code to the `End of <body> tag` section:+```html<script src="https://swetrix.org/swetrix.js" defer></script><script>- document.addEventListener('DOMContentLoaded', function() {+ document.addEventListener('DOMContentLoaded', function () {swetrix.init('YOUR_PROJECT_ID')swetrix.trackViews()})@@ -43,6 +44,7 @@ It's important to remember to replace `YOUR_PROJECT_ID` with your actual Project:::## Check your installation+After installing Swetrix tracking script, go to your website and visit some pages.Within a minute you should be able to see new pageviews being added to your project's dahsboard.diff --git a/docs/integrations/ghost.md b/docs/integrations/ghost.mdindex 5eefe833e..fdc5bc98c 100644--- a/docs/integrations/ghost.md+++ b/docs/integrations/ghost.md@@ -6,15 +6,18 @@ slug: /ghost-integrationAfter you sign up on Swetrix and create a new project, the only thing left is to add it to your website.## Installation+1. Log in to your Ghost admin account.2. Open `Settings`, go to the `Code Injection` section.3. To the `Site Header` section you need to add the following:+```html<script src="https://swetrix.org/swetrix.js" defer></script>```5. In the `Site Footer` section you need to add the following:+```html<script>document.addEventListener('DOMContentLoaded', function () {@@ -24,7 +27,11 @@ After you sign up on Swetrix and create a new project, the only thing left is to</script><noscript>- <img src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID" alt="" referrerpolicy="no-referrer-when-downgrade" />+ <img+ src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID"+ alt=""+ referrerpolicy="no-referrer-when-downgrade"+ /></noscript>```@@ -33,6 +40,7 @@ It's very important not to forget to replace `YOUR_PROJECT_ID` with your actual:::## Check your installation+After installing Swetrix tracking script, go to your website and visit some pages.Within a minute you should be able to see new pageviews being added to your project's dahsboard.diff --git a/docs/integrations/google-tag-manager.md b/docs/integrations/google-tag-manager.mdindex 53abfd3fa..e6e761841 100644--- a/docs/integrations/google-tag-manager.md+++ b/docs/integrations/google-tag-manager.md@@ -8,47 +8,50 @@ import useBaseUrl from '@docusaurus/useBaseUrl';You can use Google Tag Manager to add the Swetrix tracking script to your website.## Installation (Swetrix Loader tag)+1. Sign in to your Google Tag Manager account, click on **Tags** and then **New**.-<img alt="Creating a new tag" src={useBaseUrl('img/integrations/gtm/gtm-1.png')} />+ <img alt="Creating a new tag" src={useBaseUrl('img/integrations/gtm/gtm-1.png')} />2. Under the **Tag Configuration** section, click on "Choose a tag type to begin set-up...".-<img alt="Tag Configuration" src={useBaseUrl('img/integrations/gtm/gtm-2.png')} />-+ <img alt="Tag Configuration" src={useBaseUrl('img/integrations/gtm/gtm-2.png')} />3. Select **Custom HTML**-<img alt="Custom HTML" src={useBaseUrl('img/integrations/gtm/gtm-3.png')} />+ <img alt="Custom HTML" src={useBaseUrl('img/integrations/gtm/gtm-3.png')} />4. In the HTML input field, paste the following code:+```html<script src="https://swetrix.org/swetrix.js" defer></script>```+This code is responsible for loading the Swetrix script into your website. We will configure the tracking script later in this tutorial.5. Under **Triggering** section, click on "Choose a trigger to mage this tag fire..." and select **All pages** (or alternatively, you can filter the pages you want Swetrix to be enabled on as well).6. Give your tag a name, change "Untitled Tag" to something like **Swetrix Loader**. The result should look like this:-<img alt="Final result" src={useBaseUrl('img/integrations/gtm/gtm-4.png')} />+ <img alt="Final result" src={useBaseUrl('img/integrations/gtm/gtm-4.png')} />7. Click on the **Save** button.## Set up (Swetrix Configuration tag)+After you verified that the loader tag looks fine, you will need to create another tag. The purpose of the second tag is to configure the tracking script you installed before. If you do not create the second tag, Swetrix will not track your analytics events.1. Go to the **Tags** again and click on **New**.-2. Under the **Tag Configuration** section, click on "Choose a tag type to begin set-up...".3. Select **Custom HTML**.4. In the HTML input field, paste the following code:+```html<script>if (document.readyState !== 'loading') {- swetrixInit();+ swetrixInit()} else {- document.addEventListener('DOMContentLoaded', swetrixInit);+ document.addEventListener('DOMContentLoaded', swetrixInit)}-+function swetrixInit() {// Here you can configure Swetrix for your needsswetrix.init('YOUR_PROJECT_ID')@@ -65,7 +68,7 @@ You can also refer to our detailed [tracking script reference](/swetrix-js-refer5. Give your tag a name, change "Untitled Tag" to something like **Swetrix Configuration**.6. Under the **Tag Configuration** section, click on **Advanced Settings** and then **Tag Sequencing**. Click on the **Fire a tag before Swetrix Configuration fires** and select **Swetrix Loader** (the tag we've set up before).-<img alt="Configuration tag setup" src={useBaseUrl('img/integrations/gtm/gtm-5.png')} />+ <img alt="Configuration tag setup" src={useBaseUrl('img/integrations/gtm/gtm-5.png')} />7. Click on "Don't fire Swetrix Configuration if Swetrix Loader fails or is paused". Setting this up will make sure that Swetrix config will execute after the tracking script has loaded.@@ -78,6 +81,7 @@ You can also refer to our detailed [tracking script reference](/swetrix-js-refer11. Then click the **Publish** button to apply newly created tags.## Check your installation+After setting up the Swetrix analytics tag, go to your website and visit some pages.Within a minute you should be able to see new pageviews being added to your project's dahsboard.diff --git a/docs/integrations/sveltekit.md b/docs/integrations/sveltekit.mdindex 62ce1d268..22a2cada3 100644--- a/docs/integrations/sveltekit.md+++ b/docs/integrations/sveltekit.md@@ -6,25 +6,27 @@ slug: /sveltekit-integrationAfter you sign up on Swetrix and create a new project, the only thing left is to add it to your website.## Installation+1. Install the Swetrix package via `npm install swetrix`.2. Go to your SvelteKit website codebase and either create a new `+layout.svelte` file or use an existing one.3. Make your layout file look like this:+```html<script>- import { onMount } from "svelte";- import { browser, dev } from '$app/environment';- import { page } from "$app/stores";- import * as Swetrix from "swetrix";+ import { onMount } from 'svelte'+ import { browser, dev } from '$app/environment'+ import { page } from '$app/stores'+ import * as Swetrix from 'swetrix'onMount(() => {- Swetrix.init("YOUR_PROJECT_ID", { devMode: dev, disabled: dev });- Swetrix.trackViews();- });+ Swetrix.init('YOUR_PROJECT_ID', { devMode: dev, disabled: dev })+ Swetrix.trackViews()+ })// Trigger a pageview everytime the user navigates.- // We use the `browser` env variable to ensure that we don't try to+ // We use the `browser` env variable to ensure that we don't try to// call trackViews while the component is doing SSR.- $: $page.url.pathname, browser && Swetrix.trackViews();+ $: ($page.url.pathname, browser && Swetrix.trackViews())</script><!-- Your site's content gets injected here -->@@ -36,6 +38,7 @@ It's very important not to forget to replace `YOUR_PROJECT_ID` with your actual:::## Check your installation+After installing Swetrix tracking script, go to your website and visit some pages.Within a minute you should be able to see new pageviews being added to your project's dahsboard.diff --git a/docs/integrations/webflow.md b/docs/integrations/webflow.mdindex 62e3b766c..af4042631 100644--- a/docs/integrations/webflow.md+++ b/docs/integrations/webflow.md@@ -8,17 +8,19 @@ import useBaseUrl from '@docusaurus/useBaseUrl';After you sign up on Swetrix and create a new project, the only thing left is to add it to your website.## Installation+1. Log in to your Webflow account.-2. Open up your project, go to the `Project Settings > Custom Code` section:-<img alt="Webflow screenshot" src={useBaseUrl('img/webflow-int.png')} />+ <img alt="Webflow screenshot" src={useBaseUrl('img/webflow-int.png')} />3. In the `Head code` section you need to add the following:+```html<script src="https://swetrix.org/swetrix.js" defer></script>```4. In the `Footer code` section you need to add the following:+```html<script>document.addEventListener('DOMContentLoaded', function () {@@ -28,7 +30,11 @@ After you sign up on Swetrix and create a new project, the only thing left is to</script><noscript>- <img src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID" alt="" referrerpolicy="no-referrer-when-downgrade" />+ <img+ src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID"+ alt=""+ referrerpolicy="no-referrer-when-downgrade"+ /></noscript>```@@ -37,10 +43,11 @@ It's very important not to forget to replace `YOUR_PROJECT_ID` with your actual:::## Check your installation+After installing Swetrix tracking script, go to your website and visit some pages.Within a minute you should be able to see new pageviews being added to your project's dahsboard.:::infoCustom scripts will only appear on the published Webflow site.-:::\ No newline at end of file+:::diff --git a/docs/integrations/wix.md b/docs/integrations/wix.mdindex a3c12f9d2..35179427c 100644--- a/docs/integrations/wix.md+++ b/docs/integrations/wix.md@@ -6,19 +6,23 @@ slug: /wix-integrationAfter you sign up on Swetrix and create a new project, the only thing left is to add it to your website.## Installation+1. Log in to your Wix account.2. Go to the Settings page on your Wix site dashboard.3. Click on the `Custom Code` tab under `Advanced Settings`.4. Click on Add `Custom Code` at the top right.5. Paste the following Swetrix snippet:+```html<script src="https://swetrix.org/swetrix.js" defer></script>```+6. Give it a name so that you can easily recognize this snippet later.7. Select `All pages` under "Add Code to Pages" to track all pages on your website. Leave the default option Load once if asked.8. Select `Head` when asked where to place the code snippet.9. Click `Apply`.10. Repeat all the steps above, but this time paste the following script:+```html<script>document.addEventListener('DOMContentLoaded', function () {@@ -28,17 +32,23 @@ After you sign up on Swetrix and create a new project, the only thing left is to</script><noscript>- <img src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID" alt="" referrerpolicy="no-referrer-when-downgrade" />+ <img+ src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID"+ alt=""+ referrerpolicy="no-referrer-when-downgrade"+ /></noscript>```+10. Select `Body - end` when asked where to place the code snippet.-10. Click `Apply` again, and done!+11. Click `Apply` again, and done!:::cautionIt's very important not to forget to replace `YOUR_PROJECT_ID` with your actual Project ID you can find in the Dashboard, otherwise tracking won't work!:::## Check your installation+After installing Swetrix tracking script, go to your website and visit some pages.-Within a minute you should be able to see new pageviews being added to your project's dahsboard.\ No newline at end of file+Within a minute you should be able to see new pageviews being added to your project's dahsboard.diff --git a/docs/integrations/wordpress.md b/docs/integrations/wordpress.mdindex 2dea0784a..2aa992992 100644--- a/docs/integrations/wordpress.md+++ b/docs/integrations/wordpress.md@@ -6,16 +6,19 @@ slug: /wordpress-integrationAfter you sign up on Swetrix and create a new project, the only thing left is to add it to your website.## Installation+1. Log in to your Wordpress account.2. Install a plugin for adding the code to your HTML, for instance the [Insert Headers and Footers plugin](https://wordpress.org/plugins/insert-headers-and-footers).3. Open up your project, go to the `Project Settings > Custom Code` section.4. To the `Scripts in Header` section you need to add the following:+```html<script src="https://swetrix.org/swetrix.js" defer></script>```5. In the `Scripts in Footer` section you need to add the following:+```html<script>document.addEventListener('DOMContentLoaded', function () {@@ -25,7 +28,11 @@ After you sign up on Swetrix and create a new project, the only thing left is to</script><noscript>- <img src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID" alt="" referrerpolicy="no-referrer-when-downgrade" />+ <img+ src="https://api.swetrix.com/log/noscript?pid=YOUR_PROJECT_ID"+ alt=""+ referrerpolicy="no-referrer-when-downgrade"+ /></noscript>```@@ -34,6 +41,7 @@ It's very important not to forget to replace `YOUR_PROJECT_ID` with your actual:::## Check your installation+After installing Swetrix tracking script, go to your website and visit some pages.Within a minute you should be able to see new pageviews being added to your project's dahsboard.diff --git a/docs/script-reference.md b/docs/script-reference.mdindex 34e0af406..43f8d0c07 100644--- a/docs/script-reference.md+++ b/docs/script-reference.md@@ -8,10 +8,12 @@ import useBaseUrl from '@docusaurus/useBaseUrl';The Swetrix.js is a highly customisable tracking script. The following is a reference of all the available functions and options it provides.## init()+This fuction is used to initialise the analytics.Basically you're letting the script know which project do you want to use it with, as well as specifying your custom parameters if needed.It takes two arguments:+1. `projectID` - the ID of the project you want to use it with.2. `options` - an object with custom options.@@ -26,14 +28,15 @@ swetrix.init('YOUR_PROJECT_ID', {})```-| Name | Description | Default value |-| --- | --- | --- |-| devMode | When set to `true`, localhost events will be sent to server. | `false` |-| disabled | When set to true, the tracking library won't send any data to server.<br />Useful for development purposes when this value is set based on '.env' var. | `false` |-| respectDNT | By setting this flag to true, we will not collect ANY kind of data about the user with the DNT setting. <br />This setting is not true by default because our service anonymises all incoming data and does not pass it on to any third parties under any circumstances. | `false` |-| apiURL | Set a custom URL of the API server (for selfhosted variants of Swetrix). | `'https://api.swetrix.com/log'` |+| Name | Description | Default value |+| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------- |+| devMode | When set to `true`, localhost events will be sent to server. | `false` |+| disabled | When set to true, the tracking library won't send any data to server.<br />Useful for development purposes when this value is set based on '.env' var. | `false` |+| respectDNT | By setting this flag to true, we will not collect ANY kind of data about the user with the DNT setting. <br />This setting is not true by default because our service anonymises all incoming data and does not pass it on to any third parties under any circumstances. | `false` |+| apiURL | Set a custom URL of the API server (for selfhosted variants of Swetrix). | `'https://api.swetrix.com/log'` |## track()+:::cautionIt is important to ensure that no [Personal Data](https://en.wikipedia.org/wiki/Personal_data) that could identify a specific individual is transmitted in a metadata or custom event name field. Personally identifiable information (PII) is any information that can uniquely identify an individual, including full name, email address, phone number, credit card number, etc.All other information is anonymised.@@ -44,6 +47,7 @@ You should never send any identifiable data (like User ID, email, session cookieThe total number of track calls and their conversion rate will be saved.Here's an example of how to use this function with all the available options:+```javascriptswetrix.track({ev: 'YOUR_EVENT_NAME',@@ -51,15 +55,17 @@ swetrix.track({})```-| Name | Description | Default value |-| --- | --- | --- |-| ev | The event identifier you want to track.<br />This has to be a string, which:<br />1. Contains only English letters (a-Z A-Z), numbers (0-9), underscores (_) and dots (.).<br />2. Is fewer than 64 characters.<br />3. Starts with an English letter. | REQUIRED PARAMETER |-| unique | If true, only 1 event with the same ID will be saved per user session.<br />The principle of this parameter is similar to page views and unique views. | `false` |-| meta | An object that contains event-related metadata. The values of the object must be a primitive type (string, number, boolean, null) which will be converted to a string, the maximum number of keys allowed is `20` and the total length of the values combined must be less than `1000` characters.<br /> This feature is useful if you want to track additional data about your custom events, for example the custom event name might be `Sign up` and the metadata might be `{ affiliate: 'Yes', footer: 'No' }`. | `{}` |+| Name | Description | Default value |+| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |+| ev | The event identifier you want to track.<br />This has to be a string, which:<br />1. Contains only English letters (a-Z A-Z), numbers (0-9), underscores (\_) and dots (.).<br />2. Is fewer than 64 characters.<br />3. Starts with an English letter. | REQUIRED PARAMETER |+| unique | If true, only 1 event with the same ID will be saved per user session.<br />The principle of this parameter is similar to page views and unique views. | `false` |+| meta | An object that contains event-related metadata. The values of the object must be a primitive type (string, number, boolean, null) which will be converted to a string, the maximum number of keys allowed is `20` and the total length of the values combined must be less than `1000` characters.<br /> This feature is useful if you want to track additional data about your custom events, for example the custom event name might be `Sign up` and the metadata might be `{ affiliate: 'Yes', footer: 'No' }`. | `{}` |## trackViews()+Calling trackViews will result in sending the data about the user to our servers.Such data will include the following params if available:+1. `pid` - the unique Project ID request is related to.2. `lc` - users locale (e.g. en_US or uk_UA).3. `tz` - users timezone (e.g. Europe/Helsinki).@@ -79,6 +85,7 @@ On the server side we also gather users IP Address and User Agent. This data isAfter this timeframe the identifiable data is forever deleted from our servers.Here's an example of how to use this function with all the available options:+```javascriptswetrix.trackViews({unique: false,@@ -89,15 +96,16 @@ swetrix.trackViews({})```-| Name | Description | Default value |-| --- | --- | --- |-| unique | If true, only unique events will be saved. This param is useful when tracking single-page landing websites. | `false` |-| callback | A callback used to edit / prevent sending pageviews.<br />It accepts an object with pageview event data as a parameter which has the following structure: <br />lc: string \| undefined<br />tz: string \| undefined<br />ref: string \| undefined<br />so: string \| undefined<br />me: string \| undefined<br />ca: string \| undefined<br />meta: object \| undefined ("object" should contain string values only)<br />pg: string \| null \| undefined<br /><br />The callback is supposed to return the edited payload or `false` to prevent sending the pageview. If `true` is returned, the payload will be sent as-is. | `undefined` |-| heartbeatOnBackground | Send Heartbeat requests when the website tab is not active in the browser.<br />Setting this to `true` means that users who opened your website in inactive browser tab or window will not be counted into users realtime statistics.<br />Setting this to true is usually useful for services like Spotify or Youtube. | `false` |-| hash | Set to `true` to enable hash-based routing. For example if you have pages like `/#/path` or want to track pages like `/path#hash`. | `false` |-| search | Set to `true` to enable search-based routing. For example if you have pages like `/path?search`. Although it's not recommended in most cases, you can set both `hash` and `search` to `true` at the same time, in which case the pageview event will be fired when either the hash or the search part of the URL changes (again, both the hash and the search are sent to the server). | `false` |+| Name | Description | Default value |+| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- |+| unique | If true, only unique events will be saved. This param is useful when tracking single-page landing websites. | `false` |+| callback | A callback used to edit / prevent sending pageviews.<br />It accepts an object with pageview event data as a parameter which has the following structure: <br />lc: string \| undefined<br />tz: string \| undefined<br />ref: string \| undefined<br />so: string \| undefined<br />me: string \| undefined<br />ca: string \| undefined<br />meta: object \| undefined ("object" should contain string values only)<br />pg: string \| null \| undefined<br /><br />The callback is supposed to return the edited payload or `false` to prevent sending the pageview. If `true` is returned, the payload will be sent as-is. | `undefined` |+| heartbeatOnBackground | Send Heartbeat requests when the website tab is not active in the browser.<br />Setting this to `true` means that users who opened your website in inactive browser tab or window will not be counted into users realtime statistics.<br />Setting this to true is usually useful for services like Spotify or Youtube. | `false` |+| hash | Set to `true` to enable hash-based routing. For example if you have pages like `/#/path` or want to track pages like `/path#hash`. | `false` |+| search | Set to `true` to enable search-based routing. For example if you have pages like `/path?search`. Although it's not recommended in most cases, you can set both `hash` and `search` to `true` at the same time, in which case the pageview event will be fired when either the hash or the search part of the URL changes (again, both the hash and the search are sent to the server). | `false` |The `trackViews` function returns a `Promise` with an object with some methods allowing you to alter the behaviour of page tracking:+```javascript{// This function stops the tracking of pages.@@ -106,20 +114,23 @@ The `trackViews` function returns a `Promise` with an object with some methods a```## pageview()+This function is used to manually track a page view event.It's useful if your application uses esoteric routing which is not supported by Swetrix by default.This function accepts an object argument, that contains the following properties:+1. `payload` - an object that contains pageview payload. Accepts same values as the `trackViews` function `callback` property.2. (optional) `unique` - if set to `true`, only 1 event with the same ID will be saved per user session.Here are some examples of how to use this function:+```javascript// Track a page view with a path '/hello'.swetrix.pageview({payload: {pg: '/hello',- }+ },})// Track a page view with a path '/hello' and some metadata.@@ -131,14 +142,16 @@ swetrix.pageview({author: 'Andrii',type: 'story',},- }+ },})```## trackErrors()+This function is used to enable automatic client-side error monitoring. It adds an `error` event listener on your site and when an error happens - send it to our APIs.The data we collect includes the following params if available:+1. `pid` - the unique Project ID request is related to.2. `lc` - users locale (e.g. en_US or uk_UA).3. `tz` - users timezone (e.g. Europe/Helsinki).@@ -151,6 +164,7 @@ The data we collect includes the following params if available:10. `meta` - an object that contains event-related metadata. You can set it via a `callback` function.Here's an example of how to use this function with all the available options:+```javascriptswetrix.trackErrors({sampleRate: 1,@@ -158,12 +172,13 @@ swetrix.trackErrors({})```-| Name | Description | Default value |-| --- | --- | --- |-| sampleRate | A number that indicates how many errors should be sent to the server. Accepts values between 0 and 1. For example, if set to 0.5 - only ~50% of errors will be sent to Swetrix. For testing, we recommend setting this value to 1. For production, you should configure it depending on your needs as each error event counts towards your plan. | `1` |-| callback | A callback used to edit / prevent sending errors. It accepts an object which contains some information about the error (`name`, `message`, `lineno`, `colno`, `filename`, `stackTrace`), as well as some regular analytics info (`lc`, `tz`, `pg`, `meta`).<br />The callback is supposed to return the edited payload or `false` to prevent sending the pageview. If `true` is returned, the payload will be sent as-is. | `undefined` |+| Name | Description | Default value |+| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |+| sampleRate | A number that indicates how many errors should be sent to the server. Accepts values between 0 and 1. For example, if set to 0.5 - only ~50% of errors will be sent to Swetrix. For testing, we recommend setting this value to 1. For production, you should configure it depending on your needs as each error event counts towards your plan. | `1` |+| callback | A callback used to edit / prevent sending errors. It accepts an object which contains some information about the error (`name`, `message`, `lineno`, `colno`, `filename`, `stackTrace`), as well as some regular analytics info (`lc`, `tz`, `pg`, `meta`).<br />The callback is supposed to return the edited payload or `false` to prevent sending the pageview. If `true` is returned, the payload will be sent as-is. | `undefined` |The `trackErrors` function returns an object with some methods allowing you to alter the behaviour of page tracking:+```javascript{// This function stops the tracking of errors.@@ -172,9 +187,11 @@ The `trackErrors` function returns an object with some methods allowing you to a```## trackError()+This function is used to manually track an error event.This function takes the following arguments:+1. `name` - the error name (e.g. ParseError)2. (optional) `message` - error message (e.g. Malformed input)3. (optional) `lineno` - on what line in your code did the error occur (e.g. 1520)@@ -184,6 +201,7 @@ This function takes the following arguments:7. (optional) `meta` - an object that contains event-related metadata. The values of the object must be a primitive type (string, number, boolean, null) which will be converted to a string, the maximum number of keys allowed is `100` and the total length of the values combined must be less than `2000` characters.Here is an example of how to use this function:+```javascriptswetrix.trackError({name: 'ParseError',diff --git a/docs/selfhosting/configuring.md b/docs/selfhosting/configuring.mdindex 6f3d57d60..b2ae942da 100644--- a/docs/selfhosting/configuring.md+++ b/docs/selfhosting/configuring.md@@ -10,32 +10,36 @@ The easiest way to get started with Swetrix is by [using our cloud service](httpThe following environment variables are available for configuration:## Frontend (swetrix image)-| Variable | Default | Description |-| --- | --- | --- |++| Variable | Default | Description |+| --------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- || `API_URL` | `http://localhost:8080/` | URL of the self-hosted Swetrix API instance. Swetrix frontend will use this variable to connect to the API, so make sure it's correct. |## API (swetrix-api image)-| Variable | Default | Description |-| --- | --- | --- |-| `EMAIL` | Required | Email address to use for access to dashboard |-| `PASSWORD` | Required | Password to use for access to dashboard |-| `JWT_ACCESS_TOKEN_SECRET` | _auto-generated by `configure.sh`_ | Secret for JWT access tokens |-| `JWT_REFRESH_TOKEN_SECRET` | _auto-generated by `configure.sh`_ | Secret for JWT refresh tokens |-| `API_KEY` | | An optional API key for accessing your stats via the API directly. If not set - direct API access is disabled. |-| `CLOUDFLARE_PROXY_ENABLED` | `false` | If set to `true` - Swetrix will get IP address information from `cf-connecting-ip` header provided by Cloudflare. |-| `IS_PRIMARY_NODE` | `true` | You should not touch this variable unless you know what you are doing. It's used to spin off multiple API instances in a cluster, where only one of them will be primary. If changed to `false`, things like cron task manager will be disabled for this instance. |++| Variable | Default | Description |+| -------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `EMAIL` | Required | Email address to use for access to dashboard |+| `PASSWORD` | Required | Password to use for access to dashboard |+| `JWT_ACCESS_TOKEN_SECRET` | _auto-generated by `configure.sh`_ | Secret for JWT access tokens |+| `JWT_REFRESH_TOKEN_SECRET` | _auto-generated by `configure.sh`_ | Secret for JWT refresh tokens |+| `API_KEY` | | An optional API key for accessing your stats via the API directly. If not set - direct API access is disabled. |+| `CLOUDFLARE_PROXY_ENABLED` | `false` | If set to `true` - Swetrix will get IP address information from `cf-connecting-ip` header provided by Cloudflare. |+| `IS_PRIMARY_NODE` | `true` | You should not touch this variable unless you know what you are doing. It's used to spin off multiple API instances in a cluster, where only one of them will be primary. If changed to `false`, things like cron task manager will be disabled for this instance. |## Redis-| Variable | Default | Description |-| --- | --- | --- |++| Variable | Default | Description |+| ---------------- | ---------- | -------------- || `REDIS_PASSWORD` | `password` | Redis password |-| `REDIS_PORT` | `6379` | Redis port |-| `REDIS_USER` | `default` | Redis user |+| `REDIS_PORT` | `6379` | Redis port |+| `REDIS_USER` | `default` | Redis user |## Clickhouse-| Variable | Default | Description |-| --- | --- | --- |++| Variable | Default | Description |+| --------------------- | ----------- | ------------------- || `CLICKHOUSE_DATABASE` | `analytics` | ClickHouse database |-| `CLICKHOUSE_USER` | `default` | ClickHouse user |-| `CLICKHOUSE_PORT` | `8123` | ClickHouse port |-| `CLICKHOUSE_PASSWORD` | | ClickHouse password |+| `CLICKHOUSE_USER` | `default` | ClickHouse user |+| `CLICKHOUSE_PORT` | `8123` | ClickHouse port |+| `CLICKHOUSE_PASSWORD` | | ClickHouse password |diff --git a/docs/selfhosting/how-to.md b/docs/selfhosting/how-to.mdindex 981228565..c0186e33b 100644--- a/docs/selfhosting/how-to.md+++ b/docs/selfhosting/how-to.md@@ -10,7 +10,9 @@ The easiest way to get started with Swetrix is by [using our cloud service](http:::## Prerequisites+To self-host Swetrix you need to have the following:+- A server with Docker installed- Support for the x86_64 or arm64 CPU architecture on your server- At least 2GB of RAM is recommended for the best performance@@ -23,6 +25,7 @@ We've tested self-hosting Swetrix using [Hetzner Cloud](https://hetzner.cloud),### 1. Install the self-hosting repositoryTo self-host Swetrix, download the [self-hosting repository](https://github.com/swetrix/selfhosting) from GitHub.+```bashgit clone https://github.com/swetrix/selfhostingcd selfhosting@@ -53,6 +56,7 @@ docker compose up -d```After you run this command, the following containers will be started:+- `swetrix-api` - the main API server running on port `8080` by default- `swetrix-fe` - the frontend server running on port `80` by default- Redis server for cachingdiff --git a/docs/sitesettings/embed-your-analytics-dashboard-into-your-website.md b/docs/sitesettings/embed-your-analytics-dashboard-into-your-website.mdindex 73bb90b8d..61c808c19 100644--- a/docs/sitesettings/embed-your-analytics-dashboard-into-your-website.md+++ b/docs/sitesettings/embed-your-analytics-dashboard-into-your-website.md@@ -8,25 +8,34 @@ import useBaseUrl from '@docusaurus/useBaseUrl';You can embed your Swetrix analytics dashboard into any other website using an iframe. This is useful if you're building a custom admin panel, a dashboard for your customers or just want to show your stats to your visitors.### 1. Get your sharable link+First, you need to find the sharable link to your dashboard. You can get it in your [site settings](/how-to-access-site-settings) page. For people to be able to access your dashboard, you need to make it public or password-protected.### 2. Write the HTML embed code+Now you need to write the HTML code for the iframe. You can do this in any text editor, or directly in your website's code. Here's an example of how it should look like:```html-<iframe src="https://swetrix.com/projects/YOUR_PROJECT_ID?tab=traffic&theme=dark" width="1200" height="700" title="Test"></iframe>+<iframe+ src="https://swetrix.com/projects/YOUR_PROJECT_ID?tab=traffic&theme=dark"+ width="1200"+ height="700"+ title="Test"+></iframe>```### 3. Paste the code into your website+Now you can paste the code into your website's HTML. You can put it anywhere you want, but it's usually best to put it in a dedicated page or section.### Embed options and customisation+You can customise the embed code to fit your needs. For example, you can change the width and height of the iframe or change the theme to match your website's design.Here is a list of all available options:- - `theme`: `light` or `dark` - the theme of the dashboard.- - `lng`: language to display the dashboard in. Supported languages: `en`, `uk`, `pl`, `de`, `fr`. Defaults to user's browser language.- - `tab`: `traffic`, `performance`, `sessions`, `errors`, `funnels`, `alerts` - the default tab to show. By default, the traffic tab is shown.- - `tabs`: `traffic`, `performance`, `sessions`, `errors`, `funnels`, `alerts` - a comma-separated list of tabs that should be accessible in dashboard. Example: `tabs=traffic,performance,sessions` will only show the traffic, performance and sessions tabs. By default, all tabs are shown.- - `embedded` - if set to `true`, header, footer and any marketing CTAs will be hidden.- - `password` - if your dashboard is password-protected, you can pass the password as a query parameter. Example: `password=yourpassword`, this way the dashboard will be unlocked without the need to enter the password.\ No newline at end of file+- `theme`: `light` or `dark` - the theme of the dashboard.+- `lng`: language to display the dashboard in. Supported languages: `en`, `uk`, `pl`, `de`, `fr`. Defaults to user's browser language.+- `tab`: `traffic`, `performance`, `sessions`, `errors`, `funnels`, `alerts` - the default tab to show. By default, the traffic tab is shown.+- `tabs`: `traffic`, `performance`, `sessions`, `errors`, `funnels`, `alerts` - a comma-separated list of tabs that should be accessible in dashboard. Example: `tabs=traffic,performance,sessions` will only show the traffic, performance and sessions tabs. By default, all tabs are shown.+- `embedded` - if set to `true`, header, footer and any marketing CTAs will be hidden.+- `password` - if your dashboard is password-protected, you can pass the password as a query parameter. Example: `password=yourpassword`, this way the dashboard will be unlocked without the need to enter the password.diff --git a/docs/sitesettings/get-analytics-email-reports.md b/docs/sitesettings/get-analytics-email-reports.mdindex 172a23d5e..b3ea77e09 100644--- a/docs/sitesettings/get-analytics-email-reports.md+++ b/docs/sitesettings/get-analytics-email-reports.md@@ -8,6 +8,7 @@ import useBaseUrl from '@docusaurus/useBaseUrl';You can send regular email reports to your team or clients to keep them updated on your website's traffic. You can set up the frequency of the reports and the recipients.### How to set up email reports+1. Go to your [site's settings](/how-to-access-site-settings).2. Navigate to the "Email reports" section.3. Click on the "Add a recipient" button.@@ -17,6 +18,7 @@ You can send regular email reports to your team or clients to keep them updated<img alt="Settings from the Dashboard page" src={useBaseUrl('img/sitesettings/add_email_subscribers.png')} />### How to remove users from the email reports+Under the "Email reports" section you can see the list of recipients. If a recipient did not accept the invitation, you can remove them from the list by clicking on the "Remove" button.If they accepted the invitation, you can remove them from the list by clicking on the reports frequency button and in the dropdown menu click on "Remove member".diff --git a/docs/sitesettings/get-traffic-alerts.md b/docs/sitesettings/get-traffic-alerts.mdindex a62ded9c9..83a7b8f80 100644--- a/docs/sitesettings/get-traffic-alerts.md+++ b/docs/sitesettings/get-traffic-alerts.md@@ -30,11 +30,12 @@ To set up an alert,<img alt="Alerts screen" src={useBaseUrl('img/sitesettings/set_up_alert.png')} />When you click on the "Add alert" button, you will see a screen where you can create a new alert. You can set it up to trigger for different metrics, for example:- - when the number of pageviews exceeds a certain threshold (traffic spikes)- - when the number of online users is less than 10- - on every custom event (like a sale, or a signup)- - on every new error on your website- - when the number of users on your website is less than 5 during the last 24 hours- - ... and more++- when the number of pageviews exceeds a certain threshold (traffic spikes)+- when the number of online users is less than 10+- on every custom event (like a sale, or a signup)+- on every new error on your website+- when the number of users on your website is less than 5 during the last 24 hours+- ... and moreFrom the same "Alerts" tab you can also see the list of all the alerts you have set up and the last time they triggered. You can edit or delete them by clicking on the "Edit" or "Delete" buttons.diff --git a/docs/sitesettings/how-to-access-site-settings.md b/docs/sitesettings/how-to-access-site-settings.mdindex 190e8fb50..fdd818835 100644--- a/docs/sitesettings/how-to-access-site-settings.md+++ b/docs/sitesettings/how-to-access-site-settings.md@@ -8,11 +8,13 @@ import useBaseUrl from '@docusaurus/useBaseUrl';You can access your site settings in two ways:### From the dashboard+Click on the 'Settings' icon in the top right corner of site on the dashboard page.<img alt="Settings from the Dashboard page" src={useBaseUrl('img/sitesettings/settings_from_dashboard.png')} />### From your site's analytics page+Click on the 'Settings' tab in the top navigation bar of your site's analytics page.<img alt="Settings from the sites analytics page" src={useBaseUrl('img/sitesettings/settings_from_project.png')} />diff --git a/docs/sitesettings/how-to-invite-users-to-your-website.md b/docs/sitesettings/how-to-invite-users-to-your-website.mdindex 1229b0b6d..357c2057e 100644--- a/docs/sitesettings/how-to-invite-users-to-your-website.md+++ b/docs/sitesettings/how-to-invite-users-to-your-website.md@@ -14,22 +14,27 @@ If you want to share your dashboard without requiring the other person to have a:::## How to invite users to your website+1. Go to your [site settings](/how-to-access-site-settings) page.2. Scroll down to the "People" section and click the "Invite a user" button.3. Enter the email address of the person you want to invite. Please note that the person needs to have a Swetrix account with the same email address.4. Select a role for the person you're inviting. You can choose between "Admin" and "Viewer" roles.- - **Admin**: Admins have full access to your website. They can view and edit all settings, add and remove other users, and view all analytics data.- - **Viewer**: Viewers can only view your website's analytics data. They can't edit any settings or invite other users.++- **Admin**: Admins have full access to your website. They can view and edit all settings, add and remove other users, and view all analytics data.+- **Viewer**: Viewers can only view your website's analytics data. They can't edit any settings or invite other users.+5. Click the "Invite" button to send the invitation. The person will receive an email with a link to accept the invitation. Once they accept it, they will be able to access your website. We'll also display a notification in their Dashboard page to let them know they've been invited to your website and they can accept the invitation from there as well.<img alt="Invite user" src={useBaseUrl('img/sitesettings/invite_user.png')} />### Who is responsible for billing?+The owner of the website is responsible for billing and needs to have a paid subscription. If you invite someone to your website, they can access it without having a paid subscription.However, if you transfer ownership of your website to someone else, they will become responsible for billing.## How to modify user permissions+You can modify the permissions of any user at any time. To do this, go to your [site settings](/how-to-access-site-settings) page and scroll down to the "People" section. Here you can see a list of all users who have access to your website.To modify a user's permissions, click on their role. You can then change their role between "Admin" and "Viewer". Once you change the role, the user will have the new permissions immediately.@@ -37,11 +42,13 @@ To modify a user's permissions, click on their role. You can then change their r<img alt="Update user's role" src={useBaseUrl('img/sitesettings/change_role.png')} />## How to remove a user from your website+To remove a user from your website, go to your site settings, scroll down to the "People" section, click on the user you want to remove, and then click the "Remove member" button.Once you confirm the action, the user will no longer have access to your website.## How to transfer ownership of your website+To transfer ownership, navigate to your site settings, click on the "Transfer project" button (it's located in general settings of the website) and enter the email address of the person you want to transfer ownership to.You will receive an email to confirm the transfer. Once you confirm it, the other person will become the owner of the website and will be responsible for billing.diff --git a/docs/sitesettings/reset-sites-data.md b/docs/sitesettings/reset-sites-data.mdindex 7e3900954..79aaac47b 100644--- a/docs/sitesettings/reset-sites-data.md+++ b/docs/sitesettings/reset-sites-data.md@@ -16,6 +16,7 @@ To reset your site's data, click on the "Reset project" button:<img alt="Invite user" src={useBaseUrl('img/sitesettings/reset_settings.png')} />In the confirmation dialog, you will find 3 options:+1. **Reset all**: This will permanently delete all analytics data for all time, but the site ID and it's settings will remain intact.2. **Reset partially**: Partial reset allows you to delete data for a specific time range.3. **Reset via filters**: This allows you to delete data based on specific filters (e.g. delete all data for a specific referrer, country, etc.).diff --git a/docs/sitesettings/transfer-ownership.md b/docs/sitesettings/transfer-ownership.mdindex 4c5b033d3..92b1ae960 100644--- a/docs/sitesettings/transfer-ownership.md+++ b/docs/sitesettings/transfer-ownership.md@@ -5,7 +5,7 @@ slug: /how-to-transfer-ownership-of-your-websiteimport useBaseUrl from '@docusaurus/useBaseUrl';-Swetrix lets you hand over control of a website (project) to another account.+Swetrix lets you hand over control of a website (project) to another account.This is useful for freelancers, consultants, and agencies: you can set everything up - tracking code, custom events, spike alerts, etc. and then transfer project to the client.diff --git a/docs/troubleshooting.md b/docs/troubleshooting.mdindex 41a18b191..64b0039b6 100644--- a/docs/troubleshooting.md+++ b/docs/troubleshooting.md@@ -23,14 +23,16 @@ You should also check the "Network" tab to see if the script is loaded correctly<img alt="Browser Network tab" src={useBaseUrl('img/swetrix-network-tab.png')} />## Visits are not appearing in the Dashboard+Don't worry if you don't see any visits in the dashboard right away. There may be a small delay (up to 10 seconds) before they appear. That's because we cache the data for a short period of time to reduce the load on our servers, instead of sending it to the database right away.In case you don't see any visits even after a delay, make sure you don't have an ad-blocker or a similar extension active, as it may interfere with the script. Try visiting your website in a different browser or device to see if the issue persists.## Common issues and how to fix them- - **Make sure that you entered a correct Project ID in the script configuration**. Sometimes mistype their Project IDs in the integration or use the wrong ID (for example, an API key). You can find your Project ID on the Project Settings page in dashboard.- - **Did you set up Content Security Policy (CSP) on your site?**. If you did, make sure to add Swetrix to the list of allowed domains. The simplest way to do this is `Content-Security-Policy: default-src 'self' *.swetrix.com *.swetrix.org`, but we recommend you to read more about CSP and set it up properly.- - **Are you testing your integration on localhost?**. By default, Swetrix doesn't track any events on localhost to prevent developers from polluting their data with test events. If you want to test your integration on localhost, you can enable the `devMode` option in the [script configuration](/swetrix-js-reference#init).- - **Do you use caching on your site?**. Make sure to purge the cache after you install Swetrix script, to ensure you're loading the latest version of your site.- - **Did you set up allowed domains in the Project settings?**. If you did, you might have misspelled your domain name or added a `www.` prefix to it while your site does not use it (or vice versa).- - **You might be using an SPA or a similar framework**. You might have set up the script inproperly. Generally, we recommend using [Swetrix via NPM](/install-script#install-swetrix-via-npm) for such application.++- **Make sure that you entered a correct Project ID in the script configuration**. Sometimes mistype their Project IDs in the integration or use the wrong ID (for example, an API key). You can find your Project ID on the Project Settings page in dashboard.+- **Did you set up Content Security Policy (CSP) on your site?**. If you did, make sure to add Swetrix to the list of allowed domains. The simplest way to do this is `Content-Security-Policy: default-src 'self' *.swetrix.com *.swetrix.org`, but we recommend you to read more about CSP and set it up properly.+- **Are you testing your integration on localhost?**. By default, Swetrix doesn't track any events on localhost to prevent developers from polluting their data with test events. If you want to test your integration on localhost, you can enable the `devMode` option in the [script configuration](/swetrix-js-reference#init).+- **Do you use caching on your site?**. Make sure to purge the cache after you install Swetrix script, to ensure you're loading the latest version of your site.+- **Did you set up allowed domains in the Project settings?**. If you did, you might have misspelled your domain name or added a `www.` prefix to it while your site does not use it (or vice versa).+- **You might be using an SPA or a similar framework**. You might have set up the script inproperly. Generally, we recommend using [Swetrix via NPM](/install-script#install-swetrix-via-npm) for such application.