SDK Customizer

Generate custom SDKs for any programming language including Python, PHP, Rust, Go, and C++.

Customizer vs Installer vs NPM

Choose how you install Sublyzer:

  • SDK Customizer (this page) — browser tool at /sdk-customizer; download generated source.
  • Installer (.exe) sublyzer-installer.exe for Windows; same languages, writes files locally.
  • NPM@sublyzer/browser, @sublyzer/react for JS/React apps (API Reference).
Custom SDK generation

The SDK Customizer generates integration code for any supported language or framework — tailored feature flags, no manual boilerplate.

Supported languages

JavaScript/TypeScript
Python
PHP
Rust
Go
C++
How to use the Customizer

Access the SDK Customizer at /sdk-customizer

  1. Select your language

    Choose from JavaScript, Python, PHP, Rust, Go, or C++

  2. Select your framework (optional)

    Each language has framework-specific options (e.g., Flask, Django for Python)

  3. Enter your integration code

    Paste the 24-character code from your integration

  4. Configure options

    Enable/disable specific features like performance tracking, error capture, etc.

  5. Copy or download the code

    Get the generated code ready to paste into your project

JavaScript / TypeScript

For JavaScript projects without NPM, use the inline SDK or script tag.

Script tag (CDN)

<script
  src="https://www.sublyzer.com/sublyzer.js"
  data-integration-code="YOUR_INTEGRATION_CODE"
  defer
></script>

Inline SDK

The customizer generates a complete inline SDK (~1000 lines) that you can embed directly. This is useful for environments where external scripts aren't allowed.

Python

Generate Python code for web frameworks or standalone applications.

Supported frameworks

  • Flask — Middleware for Flask applications
  • Django — Middleware for Django projects
  • FastAPI — Async middleware for FastAPI
  • Standalone — Pure Python for any application

Example: Flask

from flask import Flask, request
import requests
import traceback
import time

app = Flask(__name__)

SUBLYZER_CODE = "YOUR_INTEGRATION_CODE"
SUBLYZER_API = "https://api.sublyzer.com/v1/events"

class SublyzerMiddleware:
    def __init__(self, app):
        self.app = app
        
    def __call__(self, environ, start_response):
        start_time = time.time()
        try:
            return self.app(environ, start_response)
        except Exception as e:
            self._send_error(e, environ)
            raise
        finally:
            duration = (time.time() - start_time) * 1000
            self._send_performance(environ, duration)
    
    def _send_error(self, error, environ):
        requests.post(SUBLYZER_API, json={
            "code": SUBLYZER_CODE,
            "type": "error",
            "message": str(error),
            "stack": traceback.format_exc(),
            "url": environ.get("PATH_INFO")
        })
    
    def _send_performance(self, environ, duration):
        requests.post(SUBLYZER_API, json={
            "code": SUBLYZER_CODE,
            "type": "performance",
            "url": environ.get("PATH_INFO"),
            "duration": duration
        })

app.wsgi_app = SublyzerMiddleware(app.wsgi_app)
PHP

Generate PHP code for popular frameworks and CMS platforms.

Supported frameworks

  • WordPress — Plugin-style integration
  • Laravel — Middleware for Laravel applications
  • Symfony — Event listener for Symfony projects
  • Standalone — Pure PHP for any application

Example: Laravel Middleware

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;

class SublyzerMiddleware
{
    private const CODE = 'YOUR_INTEGRATION_CODE';
    private const API = 'https://api.sublyzer.com/v1/events';
    
    public function handle(Request $request, Closure $next)
    {
        $startTime = microtime(true);
        
        try {
            $response = $next($request);
            return $response;
        } catch (\Throwable $e) {
            $this->sendError($e, $request);
            throw $e;
        } finally {
            $duration = (microtime(true) - $startTime) * 1000;
            $this->sendPerformance($request, $duration);
        }
    }
    
    private function sendError(\Throwable $e, Request $request): void
    {
        Http::post(self::API, [
            'code' => self::CODE,
            'type' => 'error',
            'message' => $e->getMessage(),
            'stack' => $e->getTraceAsString(),
            'url' => $request->path()
        ]);
    }
    
    private function sendPerformance(Request $request, float $duration): void
    {
        Http::post(self::API, [
            'code' => self::CODE,
            'type' => 'performance',
            'url' => $request->path(),
            'duration' => $duration
        ]);
    }
}
Rust

Generate Rust code for high-performance web applications.

Supported frameworks

  • Actix Web — Middleware for Actix
  • Rocket — Fairing for Rocket applications
  • Axum — Tower layer for Axum

Example: Actix Middleware

use actix_web::{dev::ServiceRequest, Error};
use reqwest::Client;
use std::time::Instant;

const SUBLYZER_CODE: &str = "YOUR_INTEGRATION_CODE";
const SUBLYZER_API: &str = "https://api.sublyzer.com/v1/events";

pub async fn sublyzer_middleware(
    req: ServiceRequest,
    next: impl Fn(ServiceRequest) -> Result<_, Error>,
) -> Result<_, Error> {
    let start = Instant::now();
    let path = req.path().to_string();
    
    let result = next(req);
    
    let duration = start.elapsed().as_millis() as f64;
    
    // Send performance data asynchronously
    let client = Client::new();
    tokio::spawn(async move {
        let _ = client.post(SUBLYZER_API)
            .json(&serde_json::json!({
                "code": SUBLYZER_CODE,
                "type": "performance",
                "url": path,
                "duration": duration
            }))
            .send()
            .await;
    });
    
    result
}
Go

Generate Go code for web frameworks and microservices.

Supported frameworks

  • Gin — Middleware for Gin framework
  • Echo — Middleware for Echo framework
  • Fiber — Middleware for Fiber framework
  • net/http — Standard library handler wrapper

Example: Gin Middleware

package middleware

import (
    "bytes"
    "encoding/json"
    "net/http"
    "time"
    
    "github.com/gin-gonic/gin"
)

const (
    SublyzerCode = "YOUR_INTEGRATION_CODE"
    SublyzerAPI  = "https://api.sublyzer.com/v1/events"
)

func SublyzerMiddleware() gin.HandlerFunc {
    return func(c *gin.Context) {
        start := time.Now()
        path := c.Request.URL.Path
        
        // Process request
        c.Next()
        
        // Calculate duration
        duration := float64(time.Since(start).Milliseconds())
        
        // Send performance data asynchronously
        go sendEvent(map[string]interface{}{
            "code":     SublyzerCode,
            "type":     "performance",
            "url":      path,
            "duration": duration,
            "status":   c.Writer.Status(),
        })
    }
}

func sendEvent(data map[string]interface{}) {
    jsonData, _ := json.Marshal(data)
    http.Post(SublyzerAPI, "application/json", bytes.NewBuffer(jsonData))
}
C++

Generate C++ code for native applications, games, or embedded systems.

Example: Standalone C++

#include <string>
#include <curl/curl.h>
#include <nlohmann/json.hpp>

class Sublyzer {
public:
    static constexpr const char* CODE = "YOUR_INTEGRATION_CODE";
    static constexpr const char* API = "https://api.sublyzer.com/v1/events";
    
    static void sendError(const std::string& message, const std::string& stack = "") {
        nlohmann::json payload = {
            {"code", CODE},
            {"type", "error"},
            {"message", message},
            {"stack", stack}
        };
        sendRequest(payload.dump());
    }
    
    static void sendPerformance(const std::string& operation, double durationMs) {
        nlohmann::json payload = {
            {"code", CODE},
            {"type", "performance"},
            {"operation", operation},
            {"duration", durationMs}
        };
        sendRequest(payload.dump());
    }
    
    static void trackEvent(const std::string& eventName, const nlohmann::json& properties = {}) {
        nlohmann::json payload = {
            {"code", CODE},
            {"type", "custom"},
            {"event", eventName},
            {"properties", properties}
        };
        sendRequest(payload.dump());
    }

private:
    static void sendRequest(const std::string& jsonData) {
        CURL* curl = curl_easy_init();
        if (curl) {
            curl_easy_setopt(curl, CURLOPT_URL, API);
            curl_easy_setopt(curl, CURLOPT_POSTFIELDS, jsonData.c_str());
            
            struct curl_slist* headers = nullptr;
            headers = curl_slist_append(headers, "Content-Type: application/json");
            curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
            
            curl_easy_perform(curl);
            curl_slist_free_all(headers);
            curl_easy_cleanup(curl);
        }
    }
};
Configuration options

When generating an SDK, you can configure which features to include:

Error Tracking

Capture and report exceptions with stack traces

Performance Monitoring

Track response times and Core Web Vitals

Session Tracking

Track user sessions and page views

Custom Events

Include helpers for tracking custom events

Security Scanning

Include basic security heuristics

Async Sending

Send data asynchronously to avoid blocking

Best practices

SDK tips

  • Always send events asynchronously to avoid blocking your app
  • Store your integration code in environment variables
  • Handle network failures gracefully — don't crash if Sublyzer is unreachable
  • Use the pre-built NPM packages when possible for JavaScript
  • Test your integration in development before deploying to production
  • Regenerate the SDK if you update your integration settings

Need help? Join our Discord.