td-javascript-sdk

td-javascript-sdk is a skill for Claude Code from treasure-data/td-skills. It costs 50 tokens per session (960 once invoked), scanned A, original, Apache-2.0.

A guide to using Treasure Data's JavaScript SDK to import data from web applications.

In plain words
What is it for?
Use it for browser event tracking, page analytics, client-side collection, and adding the JavaScript SDK to a web application.
Why use it?
It helps collect browser-side events and page analytics in a consistent way instead of implementing the data-collection integration manually.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the sdk-skills plugin — 2 skills shipped together

Good fit Use it for browser event tracking, page analytics, client-side collection, and adding the JavaScript SDK to a web application.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/treasure-data/td-skills/javascript
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add treasure-data/td-skills --skill javascript
Clone the repo
git clone --depth 1 https://github.com/treasure-data/td-skills

Made for: Claude Code.

Or install sdk-skills, the plugin that ships this one along with the rest of its 2 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for td-javascript-sdk

README.md
[![agentmods](https://agentmods.dev/badge/skills/treasure-data/td-skills/javascript/github.svg)](https://agentmods.dev/skills/treasure-data/td-skills/javascript)
Your own site
<a href="https://agentmods.dev/skills/treasure-data/td-skills/javascript"><img src="https://agentmods.dev/badge/skills/treasure-data/td-skills/javascript/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for td-javascript-sdk

Your own site · 80×15
<a href="https://agentmods.dev/skills/treasure-data/td-skills/javascript"><img src="https://agentmods.dev/badge/skills/treasure-data/td-skills/javascript.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 960 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00050 $0.00960
Opus 5.5 $0.00020 $0.00384
Sonnet 5.5 $0.00010 $0.00192
Haiku 4.5 $0.00005 $0.00096

Measured 3mo ago against content hash 3910341837f2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

td-javascript-sdk scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

sdk-skills/javascript/SKILL.md · 101 lines

How it starts

The opening of the file, as written. The whole thing — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Treasure Data JavaScript SDK

Browser-only SDK for client-side event tracking. For server-side, use REST API or pytd.

Quick Start: Pageview Tracking

Add to HTML <head>:

<!-- TD JS SDK Loader (v4.4.1) -->
<script type="text/javascript">
!function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[Array.prototype.slice.call(arguments)]},e[t].clients=[];for(var r=function(t){return function(){return this["_"+t]=this["_"+t]||[],this["_"+t].push(Array.prototype.slice.call(arguments)),this}},s=["collectTags","addRecord","blockEvents","fetchServerCookie","fetchGlobalID","fetchUserSegments","fetchPersonalization","resetUUID","ready","setSignedMode","setAnonymousMode","set","trackEvent","trackPageview","trackClicks","unblockEvents"],c=0;c<s.length;c++){var o=s[c];e[t].prototype[o]=r(o)}var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://cdn.treasuredata.com/sdk/4.4.1/td.min.js";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(n,i)}}("Treasure",this);
</script>

<!-- Initialize and track -->
<script type="text/javascript">
var td = new Treasure({
  database: 'your_database',
  writeKey: '1234/xxxxxxxx',  // write-only API key
  host: 'us01.records.in.treasuredata.com'
});
td.trackPageview('pageviews');
</script>

Configuration

var td = new Treasure({
  database: 'your_database',        // required
  writeKey: '1234/xxxxxxxx',        // required, write-only API key
  host: 'us01.records.in.treasuredata.com',  // required for v4.0+
  development: true                 // optional, enables console logging
});

Regional Streaming Endpoints (v4.0+ required):

Region Endpoint
US us01.records.in.treasuredata.com
Tokyo ap01.records.in.treasuredata.com
EU eu01.records.in.treasuredata.com
AP ap02.records.in.treasuredata.com

Core Methods

// Track pageview (auto-collects URL, title, referrer, user agent, etc.)
td.trackPageview('pageviews');

// Track custom events (also auto-collects context like trackPageview)
td.trackEvent('events', { action: 'signup', location: 'header' });

// Send raw records (no auto-collected fields)
td.addRecord('purchases', { order_id: '123', amount: 99.99 });

// Auto-track clicks on links, buttons, inputs (excludes password fields)
td.trackClicks({ tableName: 'clicks' });

// Set global properties (included in all subsequent trackEvent/trackPageview calls)
td.set('$global', { user_id: 'user_123', environment: 'production' });

Read the full file on GitHub · 101 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 101 lines · 50 tokens per session scan A 3910341837f2

Subscribe to this mod's changes

td-javascript-sdk is a skill published in the GitHub repository treasure-data/td-skills (23 stars, last pushed 2d ago), licensed Apache-2.0. It adds 50 tokens to every session and 960 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

td-javascript-sdk compared with skills from other repositories

td-javascript-sdk next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
td-javascript-sdktreasure-data/td-skillsSkill232d agoApache-2.0A50Claude Code
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill82ktodayMITA200Claude Code, Codex
imagegenopenai/codexSkill137ktodayApache-2.0A113Codex
playwright-climicrosoft/playwrightSkill102ktodayApache-2.0A19Claude Code
browser-automationopenclaw/openclawSkill396ktodayMITA36Claude Code
free-llm-apismnfst/awesome-free-llm-apisSkill15ktodayCC0-1.0A113Claude Code, Codex
systematic-debuggingobra/superpowersSkill331k5d agoMITA21Claude Code