Skip to content

📈 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!

Added documentation related to the trackViews return

Blue Mouse3bfaecc3ef46
diff --git a/src/pages/Docs/Docs.jsx b/src/pages/Docs/Docs.jsx
index 597ee7964..4e8c439d1 100644
--- a/src/pages/Docs/Docs.jsx
+++ b/src/pages/Docs/Docs.jsx
@@ -7,7 +7,8 @@ import { useTranslation, Trans } from 'react-i18next'
import Title from 'components/Title'
import Code from 'ui/Code'
import {
- umdBuildExample, trackPageView, trackPVAPI, init, track, trackExample, npmInstall, esExample, npmImport,
+ umdBuildExample, trackPageView, trackPVAPI, init, track, trackExample, npmInstall,
+ esExample, npmImport, trackPVReturnAPI,
} from './examples'
const contents = (t) => [{
@@ -199,14 +200,18 @@ const Docs = () => {
/>
</div>
<Code text={trackPVAPI} language='javascript' />
+ <p className='text-lg text-gray-900 dark:text-gray-50 tracking-tight'>
+ {t('docs.tvReturn')}
+ </p>
+ <Code text={trackPVReturnAPI} language='javascript' />
<hr className='mt-10 mb-4' />
<div className='text-lg text-gray-900 dark:text-gray-50 tracking-tight'>
- <i>Last updated: May 4, 2022.</i><br />
+ <i>Last updated: May 22, 2022 (Swetrix.js v1.3.2).</i><br />
<div>
- - Added&nbsp;
- <a className='hover:underline text-gray-700 dark:text-gray-300' href='#docs-int'>integrations</a>
- &nbsp;section.
+ - Added documentation related to&nbsp;
+ <a className='hover:underline text-gray-700 dark:text-gray-300' href='#docs-tv'>the object</a>
+ &nbsp;trackViews function returns.
</div>
</div>
</div>
diff --git a/src/pages/Docs/examples.js b/src/pages/Docs/examples.js
index 7251a5833..51f340822 100644
--- a/src/pages/Docs/examples.js
+++ b/src/pages/Docs/examples.js
@@ -98,3 +98,9 @@ export const trackPVAPI = `swetrix.trackViews({
// Setting this to true is usually useful for services like Spotify or Youtube
heartbeatOnBackground: false,
})`
+
+export const trackPVReturnAPI = `{
+ // This function stops the tracking of pages.
+ stop() {},
+}
+`