Skip to main content

Devunus SDK Integration

This Docusaurus documentation site has the Devunus JavaScript Client SDK integrated to track user interactions and page views.

Integration Details

Package Installation

The SDK is installed via npm:

npm install @devunus/js-client-sdk

Note: The latest version (0.0.122) is compatible with Docusaurus using CommonJS require syntax to avoid ES module resolution issues.

Plugin Structure

The SDK is integrated using a custom Docusaurus plugin located at:

  • src/plugins/devunus-sdk/index.ts - Plugin definition
  • src/plugins/devunus-sdk/client.ts - SDK initialization and tracking logic

Import Method

The SDK uses CommonJS require syntax to avoid ES module resolution issues:

const devunusClient = require('@devunus/js-client-sdk').devunusClient;

Configuration

The SDK is initialized with:

  • Environment Key: 51358ce8-1544-4554-b9bd-e9a62ca8d475c
  • Context: Anonymous user tracking (can be extended with user identification)

Automatic Tracking

The integration automatically tracks:

  • Initial page load events
  • Navigation changes between pages
  • Page view events with URL and title information

Usage in Development

During development, you can access the SDK instance globally via:

window.devunusClient

This allows you to test feature flags and manually trigger events:

// Check a feature flag
const isEnabled = window.devunusClient.getFeatureStatus('feature_name');

// Track a custom event
window.devunusClient.logEvent('button_clicked', { button_id: 'example' });

Production Deployment

The SDK will automatically initialize when the site loads and begin tracking user interactions. All events are sent to the Devunus platform for analytics and feature flag evaluation.

Testing the Integration

Visit /test-sdk to access a test page that verifies the SDK integration is working correctly. The test page includes:

  • SDK status verification
  • Event tracking test button
  • Console commands for manual testing
  • Integration details display