Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tall-suits-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gitbook/integration-salesviewer': major
---

Initial release of salesviewer integration
14 changes: 14 additions & 0 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,18 @@
"@gitbook/tsconfig": "workspace:*",
},
},
"integrations/salesviewer": {
"name": "@gitbook/integration-salesviewer",
"version": "0.1.0",
"dependencies": {
"@gitbook/api": "*",
"@gitbook/runtime": "*",
},
"devDependencies": {
"@gitbook/cli": "workspace:*",
"@gitbook/tsconfig": "workspace:*",
},
},
"integrations/segment": {
"name": "@gitbook/integration-segment",
"version": "2.1.3",
Expand Down Expand Up @@ -1027,6 +1039,8 @@

"@gitbook/integration-runllm-widget": ["@gitbook/integration-runllm-widget@workspace:integrations/runllm-widget"],

"@gitbook/integration-salesviewer": ["@gitbook/integration-salesviewer@workspace:integrations/salesviewer"],

"@gitbook/integration-segment": ["@gitbook/integration-segment@workspace:integrations/segment"],

"@gitbook/integration-sentry": ["@gitbook/integration-sentry@workspace:integrations/sentry"],
Expand Down
3 changes: 3 additions & 0 deletions integrations/salesviewer/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@gitbook/eslint-config/integration"]
}
Binary file added integrations/salesviewer/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions integrations/salesviewer/gitbook-manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: salesviewer
title: SalesViewer
icon: ./assets/icon.png
description: Track and identify GitBook page visitors with Salesviewer analytics.
previewImages:
- ./assets/salesviewer-preview.png
externalLinks:
- label: Documentation
url: https://www.salesviewer.com/en/help/
visibility: public
organization: ebg2KXDsLAQnw4pxgpm6
script: ./src/index.ts
scopes:
- site:script:inject
contentSecurityPolicy:
script-src: |
https://slsnlytcs.com;
connect-src: |
slsnlytcs.com;
summary: |
# Overview

SalesViewer® is a powerful analytics and visitor identification platform that helps you understand who visits your pages and track their behavior.

# How it works

The GitBook SalesViewer® integration allows you to track traffic in your published sites from your SalesViewer® dashboard.

Each of your connected GitBook sites will fetch the SalesViewer® tracking script and inject it in your public content, enabling visitor tracking and identification.

# Configure
Install the integration on the GitBook site of your choice.
Locate the Account ID you want to use, which is available in SalesViewer® dashboard under "Profile > Project & Tracking code":
categories:
- analytics
configurations:
site:
properties:
tracking_id:
type: string
title: Tracking ID
description: Your SalesViewer® Account ID
required:
- tracking_id
target: site
19 changes: 19 additions & 0 deletions integrations/salesviewer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@gitbook/integration-salesviewer",
"version": "0.1.0",
"private": true,
"dependencies": {
"@gitbook/api": "*",
"@gitbook/runtime": "*"
},
"devDependencies": {
"@gitbook/cli": "workspace:*",
"@gitbook/tsconfig": "workspace:*"
},
"scripts": {
"lint": "eslint ./src/**/*.ts",
"typecheck": "tsc --noEmit",
"publish-integrations-staging": "gitbook publish .",
"publish-integrations": "gitbook publish ."
}
}
39 changes: 39 additions & 0 deletions integrations/salesviewer/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
createIntegration,
FetchPublishScriptEventCallback,
RuntimeContext,
RuntimeEnvironment,
} from '@gitbook/runtime';

import script from './salesviewerScript.raw.js';

type SalesviewerRuntimeContext = RuntimeContext<
RuntimeEnvironment<
{},
{
tracking_id?: string;
}
>
>;

export const handleFetchEvent: FetchPublishScriptEventCallback = async (
event,
{ environment }: SalesviewerRuntimeContext
) => {
const trackingId = environment.siteInstallation?.configuration?.tracking_id;

if (!trackingId) {
return;
}

return new Response(script.replace('<TO_REPLACE>', trackingId), {
headers: {
'Content-Type': 'application/javascript',
'Cache-Control': 'max-age=604800',
},
});
};

export default createIntegration<SalesviewerRuntimeContext>({
fetch_published_script: handleFetchEvent,
});
9 changes: 9 additions & 0 deletions integrations/salesviewer/src/salesviewerScript.raw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(function (w, d, s, l, i) {
var g = w[l] ? '&s=' + w[l] : '',
f = d.getElementsByTagName(s)[0],
j = d.createElement(s);
j.async = true;
j.src = 'https://slsnlytcs.com/stm.js?id=' + i + g;
j.referrerPolicy = 'no-referrer-when-downgrade';
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'name', '<TO_REPLACE>');
3 changes: 3 additions & 0 deletions integrations/salesviewer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@gitbook/tsconfig/integration.json"
}