Skip to content

The only tool you need to know what is happening and how to fix it.

cdn deployment for jquery working and added to docs

dduxf4fdfee1477d
diff --git a/docs/pages/client/jquery/index.mdx b/docs/pages/client/jquery/index.mdx
index 0d4f1704..be65e09f 100644
--- a/docs/pages/client/jquery/index.mdx
+++ b/docs/pages/client/jquery/index.mdx
@@ -4,27 +4,34 @@ Integrate Traceway into your jQuery application with the `@tracewayapp/jquery` p
## Installation
+### Via npm
+
```bash
npm install @tracewayapp/jquery
```
-Or include via script tag after jQuery:
+```javascript
+import { init } from "@tracewayapp/jquery";
-```html
-<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
-<script src="node_modules/@tracewayapp/jquery/dist/index.mjs" type="module"></script>
+init("your-token@https://traceway.example.com/api/report");
```
-## Setup
-
-Initialize Traceway after jQuery is loaded:
+### Via CDN
-```javascript
-import { init } from "@tracewayapp/jquery";
+No build step needed — add two script tags after jQuery:
-init("your-token@https://traceway.example.com/api/report");
+```html
+<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
+<script src="https://cdn.jsdelivr.net/npm/@tracewayapp/jquery@1/dist/traceway-jquery.iife.global.js"></script>
+<script>
+ TracewayJQuery.init("your-token@https://traceway.example.com/api/report");
+</script>
```
+## What It Does
+
+Once initialized, the SDK automatically:
+
This automatically:
- Captures uncaught JavaScript errors and unhandled promise rejections
- Captures jQuery AJAX errors via `$(document).ajaxError()`
diff --git a/docs/pages/client/js-sdk/index.mdx b/docs/pages/client/js-sdk/index.mdx
index e0f040f3..ec7cfa6a 100644
--- a/docs/pages/client/js-sdk/index.mdx
+++ b/docs/pages/client/js-sdk/index.mdx
@@ -10,6 +10,7 @@ The Traceway JavaScript SDK provides error tracking for browser-based applicatio
| `@tracewayapp/react` | React bindings with Provider, Error Boundary, and hooks |
| `@tracewayapp/vue` | Vue 3 plugin and composables |
| `@tracewayapp/svelte` | Svelte context-based integration |
+| `@tracewayapp/jquery` | jQuery integration with automatic AJAX error capture |
## Installation
@@ -23,6 +24,28 @@ Or use a framework-specific package:
npm install @tracewayapp/react
npm install @tracewayapp/vue
npm install @tracewayapp/svelte
+npm install @tracewayapp/jquery
+```
+
+### Via CDN
+
+The frontend and jQuery packages are also available as standalone scripts — no bundler required:
+
+```html
+<!-- Framework-agnostic (exposes window.Traceway) -->
+<script src="https://cdn.jsdelivr.net/npm/@tracewayapp/frontend@1/dist/traceway.iife.global.js"></script>
+<script>
+ Traceway.init("your-token@https://traceway.example.com/api/report");
+</script>
+```
+
+```html
+<!-- jQuery (exposes window.TracewayJQuery) -->
+<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
+<script src="https://cdn.jsdelivr.net/npm/@tracewayapp/jquery@1/dist/traceway-jquery.iife.global.js"></script>
+<script>
+ TracewayJQuery.init("your-token@https://traceway.example.com/api/report");
+</script>
```
## Connection String Format
diff --git a/examples/devtesting-embedded/README.md b/examples/devtesting-embedded/README.md
new file mode 100644
index 00000000..d387bbaa
--- /dev/null
+++ b/examples/devtesting-embedded/README.md
@@ -0,0 +1,36 @@
+# devtesting-embedded
+
+Distributed tracing demo with a Go backend and jQuery frontend. Shows two ways to integrate `@tracewayapp/jquery`:
+
+## Quick Start (CDN page only)
+
+```bash
+go run .
+```
+
+Open http://localhost:8080/cdn — works immediately, no build step. jQuery and Traceway are loaded from CDN.
+
+## Full Setup (both pages)
+
+```bash
+cd frontend && npm install && npm run build && cd ..
+go run .
+```
+
+## Pages
+
+| URL | Description | Build required? |
+|-----|-------------|-----------------|
+| http://localhost:8080 | Node-built version — `@tracewayapp/jquery` bundled via Vite into `static/app.js` | Yes (`npm install && npm run build` in `frontend/`) |
+| http://localhost:8080/cdn | CDN version — loads `@tracewayapp/[email protected]` IIFE bundle from jsdelivr | No |
+| http://localhost:8082 | Traceway dashboard | No |
+
+Both pages have the same functionality: error button, success button, and a log showing trace IDs. Login to the dashboard with `[email protected]` / `admin`.
+
+## How it works
+
+1. Go serves both HTML pages and the API endpoints on port 8080
+2. Traceway backend runs on port 8082 with SQLite storage
+3. Click "Call Backend Error Endpoint" to trigger a 500 error
+4. The `traceway-trace-id` header links the jQuery frontend exception to the Go backend error
+5. Both appear in the Traceway dashboard under their respective projects, connected by the distributed trace
diff --git a/examples/devtesting-embedded/cdn.html b/examples/devtesting-embedded/cdn.html
new file mode 100644
index 00000000..7c72b6db
--- /dev/null
+++ b/examples/devtesting-embedded/cdn.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Distributed Trace Test (CDN)</title>
+ <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
+ <script src="https://cdn.jsdelivr.net/npm/@tracewayapp/[email protected]/dist/traceway-jquery.iife.global.js"></script>
+ <style>
+ body { font-family: system-ui, -apple-system, sans-serif; max-width: 700px; margin: 40px auto; padding: 0 20px; }
+ h1 { margin-bottom: 8px; }
+ p { color: #555; line-height: 1.5; }
+ code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
+ .badge { display: inline-block; background: #dbeafe; color: #1d4ed8; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 9999px; margin-left: 8px; vertical-align: middle; }
+ .buttons { display: flex; gap: 12px; margin-bottom: 24px; }
+ .btn { color: #fff; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600; }
+ .btn:hover { opacity: 0.9; }
+ .btn-error { background: #dc2626; }
+ .btn-success { background: #16a34a; }
+ .btn-clear { background: #6b7280; }
+ #log { background: #111; color: #0f0; padding: 16px; border-radius: 8px; font-family: monospace; font-size: 13px; min-height: 200px; white-space: pre-wrap; }
+ </style>
+</head>
+<body>
+ <h1>Distributed Trace Test <span class="badge">CDN</span></h1>
+ <p>
+ This page loads <code>@tracewayapp/jquery</code> directly from the jsdelivr CDN — no npm install or build step needed.
+ Click the error button to trigger a backend 500 error. The
+ <code>traceway-trace-id</code> header links the frontend exception
+ to the backend error in the dashboard.
+ </p>
+
+ <div class="buttons">
+ <button class="btn btn-error" id="btn-error">Call Backend Error Endpoint</button>
+ <button class="btn btn-success" id="btn-success">Call Backend Success Endpoint</button>
+ <button class="btn btn-clear" id="btn-clear">Clear Log</button>
+ </div>
+
+ <div id="log">Waiting for actions...</div>
+
+ <script>
+ TracewayJQuery.init("frontend-dev-token@http://localhost:8082/api/report");
+
+ function addLog(msg) {
+ var time = new Date().toLocaleTimeString();
+ var $log = $('#log');
+ var text = $log.text();
+ if (text === 'Waiting for actions...') text = '';
+ $log.text(text + '[' + time + '] ' + msg + '\n');
+ }
+
+ $(function () {
+ $('#btn-error').on('click', function () {
+ addLog('Calling GET /api/test-error ...');
+ $.ajax({
+ url: '/api/test-error',
+ method: 'GET',
+ complete: function (jqXHR) {
+ var traceId = jqXHR.getResponseHeader('traceway-trace-id');
+ addLog('Response: ' + jqXHR.status + ' \u2014 traceway-trace-id: ' + (traceId || 'not present'));
+ if (jqXHR.status >= 400) {
+ addLog('Exception auto-captured by @tracewayapp/jquery with distributedTraceId=' + traceId);
+ }
+ }
+ });
+ });
+
+ $('#btn-success').on('click', function () {
+ addLog('Calling GET /api/test-success ...');
+ $.ajax({
+ url: '/api/test-success',
+ method: 'GET',
+ complete: function (jqXHR) {
+ var traceId = jqXHR.getResponseHeader('traceway-trace-id');
+ addLog('Response: ' + jqXHR.status + ' \u2014 traceway-trace-id: ' + (traceId || 'not present'));
+ }
+ });
+ });
+
+ $('#btn-clear').on('click', function () {
+ $('#log').text('Waiting for actions...');
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/examples/devtesting-embedded/frontend/package-lock.json b/examples/devtesting-embedded/frontend/package-lock.json
index 4c562975..579d4890 100644
--- a/examples/devtesting-embedded/frontend/package-lock.json
+++ b/examples/devtesting-embedded/frontend/package-lock.json
@@ -14,9 +14,9 @@
},
"../../../../js-client/packages/jquery": {
"name": "@tracewayapp/jquery",
- "version": "1.0.2",
+ "version": "1.0.3",
"dependencies": {
- "@tracewayapp/frontend": "1.0.2"
+ "@tracewayapp/frontend": "1.0.3"
}
},
"node_modules/@esbuild/aix-ppc64": {
diff --git a/examples/devtesting-embedded/main.go b/examples/devtesting-embedded/main.go
index 28ae7105..3cf61329 100644
--- a/examples/devtesting-embedded/main.go
+++ b/examples/devtesting-embedded/main.go
@@ -18,6 +18,9 @@ import (
//go:embed index.html
var indexHTML []byte
+//go:embed cdn.html
+var cdnHTML []byte
+
//go:embed static/*
var staticFS embed.FS
@@ -66,6 +69,10 @@ func main() {
c.Data(http.StatusOK, "text/html; charset=utf-8", indexHTML)
})
+ router.GET("/cdn", func(c *gin.Context) {
+ c.Data(http.StatusOK, "text/html; charset=utf-8", cdnHTML)
+ })
+
staticSub, _ := fs.Sub(staticFS, "static")
router.StaticFS("/static", http.FS(staticSub))
@@ -82,11 +89,12 @@ func main() {
})
fmt.Println()
- fmt.Println("===========================================")
- fmt.Printf(" App: http://localhost:%d\n", appPort)
- fmt.Println(" Dashboard: http://localhost:8082")
- fmt.Println(" Login: [email protected] / admin")
- fmt.Println("===========================================")
+ fmt.Println("=================================================")
+ fmt.Printf(" Node build: http://localhost:%d\n", appPort)
+ fmt.Printf(" CDN (no build): http://localhost:%d/cdn\n", appPort)
+ fmt.Println(" Dashboard: http://localhost:8082")
+ fmt.Println(" Login: [email protected] / admin")
+ fmt.Println("=================================================")
fmt.Println()
router.Run(fmt.Sprintf(":%d", appPort))