npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yuanze_dev/tracker-miniprogram

v0.11.6

Published

原则数据埋点 SDK · 微信小程序

Downloads

1,347

Readme

Mini Program Click Text

Version 0.11.6 fixes TypeScript project output in the Node.js 22 WXML preparation tool. Runtime event behavior is unchanged. It adds optional $text to $autocapture; existing page fields are reused.

Install and lock this package, then keep the existing SDK initialization and privacy activation flow. Registration wrappers must be installed in app.js before Page or Component registration. Cold-compile and restart after upgrading.

Lifecycle Activation

The host decides when its permitted collection may begin. The SDK does not call WeChat privacy authorization APIs or grant consent on the host's behalf.

  • For startup collection, initialize before registering App or Page.
  • For deferred collection, call installAutoTrack() before registration. It installs inactive wrappers without creating identity, using storage or sending requests. After the host permits collection, call init({ autoTrack: false }), synchronize or clear identity, then call enableAutoTrack().
  • Deferred activation retains only the real launch scene/path and current visible page references in memory. It does not buffer pre-activation clicks or query parameters. The first startup/page events are sent on activation, not backdated.
  • App and visible-page durations start at activation. Activating in the background waits for visibility. Repeated activation does not duplicate the current segment.
  • Stop/resume and remote lifecycle-policy changes start a fresh observation segment. They do not fabricate another cold start or a physical foreground event. A resumed visible page gets a new pageview so its later pageleave has a matching entry; disabled time is excluded.
  • Startup and pageleave request a nonblocking flush. Persistent retry preserves event IDs, but process termination or a device that never reconnects can still lose events. App background is not a definitive user-exit signal.

envContext: false omits automatic device properties. persist: false disables the event queue persistence only; it does not disable persistent anonymous identity. Using an anonymous ID is not equivalent to irreversible anonymization. The host must separately assess notice, authorization, fields, retention and network logs.

Central Integration

Create yuanze-text.config.json in the developer tool project directory:

{
  "sourceRoot": ".",
  "outputRoot": ".yuanze-text",
  "rules": [
    { "file": "pages/index/index.wxml", "selector": ".entry", "textSelector": ".title" }
  ]
}

Rules only locate an existing label. Remove the example rule when unnecessary. Add nonstandard runtime directories through the optional include array. JavaScript and TypeScript scripts are copied unchanged, including app.ts. TypeScript projects must keep the WeChat typescript compiler plugin enabled and point the source/compile roots at the generated project. The tool does not transpile scripts. It rejects missing app, declared page/subpackage, and local component scripts before replacing output; add omitted runtime directories to include. This validates entry presence, not the entire module graph. Compile and smoke-test the generated directory, including its imports, before preview or upload. Input values and private files remain excluded as before. The default includes app files, pages, subpackages, components, utils, assets, images, styles, behaviors and miniprogram_npm. Source symlinks are rejected.

Set project.config.json miniprogramRoot to .yuanze-text/. Add the output directory to Git ignore. Run existing route generation, SDK sync and npm component preparation before this tool:

yuanze-miniprogram-text prepare
yuanze-miniprogram-text check

Connect that same sequence to beforeCompile, beforePreview and beforeUpload. For live editing run yuanze-miniprogram-text watch alongside the developer tool. Hooks alone do not establish live synchronization. The developer tool must allow hook execution. CI and manual upload commands must also run prepare and check; a successful source-only compile does not validate this integration.

analyze reports static coverage without creating output or requiring a changed miniprogramRoot. Device/preview/upload validation remains separate. check rejects stale source, changed tool/config and modified generated files. Generation preserves source WXML and callbacks and replaces only owned output.

Coverage

  • Native tap, longpress and longtap with one simple label and optional icons.
  • TDesign button simple slots and grid-item text properties, including bindings.
  • Loop bindings at the interaction node retain their original scope.
  • Central title-source rules for cards containing a title and a description.

Known TDesign adapters are resolved through usingComponents paths, including aliases. Only generated grid-item metadata enables its custom click event. Unknown custom click events, complex slots, descendant loops/conditions, template composition and dynamic handler names need a separate adapter. No input values or page/card body concatenation is performed.

The tool generates data-yz-capture, data-yz-owner, data-yz-text and optional data-yz-adapter plus mark:yzOwner. The nearest owner handles bubbling; synchronous forwarding uses one capture frame. Unmarked component internals remain silent. Arbitrary asynchronous forwarding is outside this contract.

Manual exceptions can reuse an existing value in data-yz-text="{{label}}". Components also need data-yz-capture="1". These reserved fields are excluded from data-track business properties. Existing named-event suppression is kept.

Remote captureText/maxTextLength remain authoritative. The SDK snapshots before the callback, preserves its result or exception, and discards the snapshot if capture is deactivated during the callback. Sensitive/input regions and data-sensitive/data-no-track/yz-no-track are excluded. The tool propagates sensitive marks to descendants. Pure 4-8 digit labels are omitted; phone numbers, email addresses and long numeric identifiers use existing redaction.

This preparation tool targets native WXML. Taro uses the opt-in runtime path below; web-view content needs the Web SDK in its own document.

Taro 4 Simple Click Text

Taro's generated WXML contains dynamic templates rather than business labels. Supply the same runtime document and public helper already used by the app at the central SDK initialization point:

import { document, isParentBinded } from '@tarojs/runtime';
import tracker from '@yuanze_dev/tracker-miniprogram';

tracker.init({
  endpoint: trackingEndpoint,
  writeKey: clientWriteKey,
  taroClickText: { document, isParentBinded },
});

Keep the existing privacy/initialization sequence and installAutoTrack before App/Page/Component registration. This option does not initialize another Taro runtime, mutate its nodes/events, install global hooks, or bundle the framework. It uses getElementById, public tree traversal and isOnlyClickBinded/isAnyEventBinded to find the nearest simple tap owner. Text/image/padding share that owner; only the owner's native eh invocation produces the existing autocapture event. The temporary Taro sid is not emitted as a button identifier. Text and page snapshots precede the callback and retain the SDK's sanitization and capture settings.

The initial compatibility target is Taro 4.1.8 on WeChat. Common Button/View taps with one text fragment are covered, including dynamic text and ScrollView ancestors with scroll handlers. Nested tap ancestors defer callbacks in Taro's batching, so these interactions are excluded in this initial adapter. Owners with mixed event types, custom events and longpress are also outside this path. Buttons with multiple text fragments or nested interactive/input/sensitive content omit text instead of concatenating card or page contents. Traversal is bounded to 100 label nodes and 20 ancestor levels. An explicit data-yz-text value on a simple owner can reuse an existing title when it has multiple text fragments; sensitive/input exclusions still take precedence. Native unmarked/marked paths are unchanged when the option is absent or the event has no Taro sid.

Runtime text is not a business-success signal or a stable unique button ID. The adapter does not evaluate external CSS visibility, custom canvas content, native views or web-view DOM. Test representative controls on devices and keep business-specific named events for unsupported interactions or results.

Development Exercise Observation

The optional SDK sender observer supports a prepared development Self-check exercise. A central application bootstrap enables it; business buttons, callbacks and labels do not need test-specific changes. It observes the SDK sender directly without replacing wx.request, including on devices where that property is readonly.

const onSenderEvent = (event) => exerciseObserver.record(event);
tracker.init({
  endpoint: trackingEndpoint,
  writeKey: developmentWriteKey,
  initialProperties: { $validation_run_id: validationRunId },
  testing: { enabled: true, validationRunId, onSenderEvent },
});
const state = tracker.getTestingSenderState(onSenderEvent);

Use the same callback reference for state inspection. Testing requires an explicit enable flag, a development Write Key and a valid run UUID matching the initial properties. Invalid testing configuration is rejected before an existing tracker is disposed. Keep this configuration and the test controls out of production builds.

Notifications contain only phase (started, succeeded, failed), requestId and up to 50 matching-run event references: eventId, validationRunId, validationCaseId and isAutocapture. They do not expose credentials, request bodies, labels or error objects. This is bounded sender evidence for one prepared exercise, with no arbitrary event-query API.

State includes available, healthy, validationRunId and pendingRequests. Disposal or replacement with another observer makes the old callback unavailable. Throwing or asynchronous observers make observation unhealthy without changing the actual sender result; the callback must be synchronous. Failed observation, pending sends or a missing observer must not be reported as successful delivery. Sender success alone does not prove event storage: complete the prepared exercise with task selfcheck verify. Normal initialization leaves observation disabled.