Skip to content
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

Add app.highlight.io to app to track sessions. #469

Open
wildone opened this issue Apr 12, 2023 · 1 comment
Open

Add app.highlight.io to app to track sessions. #469

wildone opened this issue Apr 12, 2023 · 1 comment

Comments

@wildone
Copy link
Member

wildone commented Apr 12, 2023

Lets add ability to track sessions for app usage.

Add the following script tag to the head section of your index.html file.

<html>
<head>
    <script src="https://unpkg.com/highlight.run"></script>
</head>
<body>
    <!-- Your Application -->
</body>
</html>

Initialize the SDK.

<YOUR_PROJECT_ID> = 4d711qdo
= let username = process.env.username || process.env.user;
OR

const os = require('os')
const userName = process.env.username ?? process.env.user ?? os?.userInfo?.()?.username

<APP_VERSION> = app.getVersion()

<html>
<head>
    <script src="https://unpkg.com/highlight.run"></script>
    <script>
        if (window.location.href.contains("&iframe")) {
          H.init('<YOUR_PROJECT_ID>', {
            isCrossOriginIframe: true,
          })
        } else {
          H.init(`<YOUR_PROJECT_ID>', { // Get your project ID from https://app.highlight.io/setup
              environment: 'production',
              version: '<APP_VERSION>',
              enableStrictPrivacy: false,
              enableCanvasRecording: true,
              samplingStrategy: {
                  canvas: 15,
                  canvasQuality: 'low',
                  canvasMaxSnapshotDimension: 480,
                },
              networkRecording: {
                  enabled: true,
                  recordHeadersAndBody: true,
                  urlBlocklist: [
                      // insert urls you don't want to record here
                  ],
              },
          });
        }
        H.identify('<USERNAME>')
    </script>
</head>
<body>
    <!-- Your Application -->
</body>
</html>

Add meta

<meta
  http-equiv="Content-Security-Policy"
  content="default-src 'self'; script-src 'self' https://static.highlight.io; worker-src blob: https://static.highlight.io; connect-src https://pub.highlight.run;"
/>

Provide option to have a query string

@wildone
Copy link
Member Author

wildone commented Apr 12, 2023

"http-equiv": "Content-Security-Policy", content: "default-src *; img-src * 'self' data: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; worker-src: 'self' 'unsafe-eval' blob:; connect-src 'self' 'unsafe-eval';"

@Harikarthyk Harikarthyk removed their assignment Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants