-
Notifications
You must be signed in to change notification settings - Fork 77
Add SalesViewer integration #894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
addisonschultz
merged 12 commits into
GitbookIO:main
from
KevinRohn:add-salesviewer-integration
Aug 13, 2025
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2735d6b
Add salesviewer integration init
KevinRohn ec877c6
Add changeset
KevinRohn cdfac95
Merge remote-tracking branch 'origin/main' into add-salesviewer-integ…
KevinRohn fc35932
remove spaces and only use sites
KevinRohn aa7a067
remove wrong lock file
KevinRohn bc3acca
Correct branding for SalesViewer in manifest file
KevinRohn 2dc10cd
added site as target; fixed external link
KevinRohn 39d8a86
Merge branch 'main' into add-salesviewer-integration
addisonschultz 5d9bf78
Merge branch 'main' into add-salesviewer-integration
KevinRohn 3f1e565
added organization id
KevinRohn af48769
Merge branch 'main' into add-salesviewer-integration
KevinRohn beed34d
Merge branch 'main' into add-salesviewer-integration
addisonschultz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@gitbook/integration-salesviewer': major | ||
--- | ||
|
||
Initial release of salesviewer integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["@gitbook/eslint-config/integration"] | ||
} |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
KevinRohn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
target: site |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ." | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@gitbook/tsconfig/integration.json" | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.