Skip to main content

Docusaurus

Install Sona Tracking Script in your documentation pages.

Step 1: Navigate to docusaurus.config.js

Step 2: Scroll down and, inside the config, add the following script.

const config = {
//Rest of the cod
headTags: [
{
tagName: 'script',
attributes: {
type: 'text/javascript',
},
innerHTML: `
//Paste your tracking script here.
`,
},
],
}

Step 3: Paste your tracking script inside innerHTML.

Note: Remove the <script> tags from the tracking script.

Example:

From this:

<script type="text/javascript"> (function()...</script>

To This:

(function()...

const config = {
//Rest of the code
headTags:[
{
tagName: 'script',
attributes: {
type: 'text/javascript',
},
innerHTML: `
//Paste your tracking script here
`
},
],
}

Verify successful installation of the tracking script on documentation pages.

There are 2 ways you can check if the tracking script is installed.

By Inspect Element

Step 1: Open a page on your documentation and right click anywhere on the page.

Step 2: A pop-up or right-click menu shows up. Select Inspect.

context menu

Step 3: In the elements tab, Use Ctrl + F and search for "sl."

Installed script

By Tracking Activity in the sonalabs platform

Step 1: Click the Tracking Activity in the sidebar.

Sidenav bar

Step 2: Scroll to the right side of the table until you see the Page header. Check if the page where you added the tracking script appears.

Tracking Activity