Skip to content

Configuration and events

Tracks usage events of Tekla plugins and .NET tools and sends them to the usage events API (POST /api/usage-events) with your tenant’s API key. Add the package, fill in plugboard-tracking.json, build — the assembly is tracked from the moment it loads, without code changes.

  • Targets .NET Framework 4.8 and .NET Standard 2.0, with no Tekla references (Tekla base classes are in Plugboard.Tracking.Tekla).
  • No JSON or other package dependencies, so nothing clashes with the assemblies Tekla loads.
  • Tracking never slows down or breaks the plugin: problems go to a local log only.
  1. Add the Plugboard.Tracking.Core package to the plugin or tool project.

  2. Build once. The build creates plugboard-tracking.json next to the project file (warning UT000).

  3. Fill in endpoint and apiKey:

    \{
    "endpoint": "https://your-app/api/usage-events",
    "apiKey": "aut_xxxxxxxx",
    "toolName": "Rebar Exporter"
    \}
  4. Make sure the project uses C# 9 or later. .NET Framework projects default to C# 7.3, so add this to the project file:

    <LangVersion>9.0</LangVersion>
  5. Build. When the assembly loads, plugin_loaded is sent.

Working examples for a model plugin, a drawing plugin and WinForms and WPF tools are in examples/.

The package’s build targets, on every build:

  • embed plugboard-tracking.json into the assembly (resource Plugboard.Tracking.plugboard-tracking.json);
  • check it and report problems as build warnings (UT001 missing, UT002 not valid JSON, UT003 a setting is wrong or missing);
  • compile a small source file with a [ModuleInitializer] into the assembly. It runs when the assembly loads and calls PlugboardTracker.InitializeAssembly(...), which reads the embedded config of that assembly, starts tracking and sends plugin_loaded.

Several tracked plugins in one Tekla process each keep their own config and tool name; they share one background sender.

Project settings:

Property Default Meaning
PlugboardTrackingConfigFile plugboard-tracking.json next to the project file The config file to embed.
PlugboardTrackingModuleInitializer true false leaves the module initializer out; call PlugboardTracker.InitializeAssembly(typeof(SomeClass).Assembly) yourself (e.g. when you can’t use C# 9).
PlugboardTrackingModuleInitializerAttribute true on .NET Framework / .NET Standard false when the project already defines System.Runtime.CompilerServices.ModuleInitializerAttribute (e.g. with PolySharp).
{
"endpoint": "https://your-app/api/usage-events",
"apiKey": "aut_xxxxxxxx",
"toolName": "Rebar Exporter",
"enabled": true,
"events": {
"plugin_loaded": true,
"plugin_run_started": false,
"plugin_run_completed": true,
"application_started": true,
"application_closed": true,
"form_opened": true,
"form_closed": false,
"button_clicked": true,
"unhandled_exception": true,
"custom": true
},
"pluginData": {
"enabled": true,
"excludeFields": ["Password", "Comment"]
},
"excludeButtons": ["btnDebug*"],
"flushIntervalSeconds": 30,
"updates": {
"enabled": true,
"checkIntervalHours": 24
}
}
Setting Default Meaning
endpoint — URL of the usage events API. Required.
apiKey — Your tenant’s API key. Required.
toolName assembly name Tool name sent with every event.
enabled true Master switch. false tracks nothing.
events see below Which events are tracked.
events.custom true All custom events (any name that isn’t an automatic event).
events.customAllowList — When set, only these custom events are tracked.
events.customDenyList — These custom events are never tracked.
pluginData.enabled false Send the plugin’s dialog values as JSON with run events.
pluginData.includeFields / excludeFields — Plugin fields to send / never send.
pluginData.maxSizeBytes 16384 Plugin data is cut to this size.
includeButtons — When set, only buttons with these names, texts or wildcard patterns (*, ?) are tracked.
excludeButtons — Button names, texts or wildcard patterns (*, ?) that aren’t tracked.
flushIntervalSeconds 30 How often queued events are sent (1–3600).
updates.enabled true Check for newer versions and show the update notification.
updates.checkIntervalHours 24 How often to check for a newer version (1–720).

Events missing from events use the defaults: all on, except plugin_run_started and form_closed. Switched-off events are never created or sent.

plugboard-tracking.override.json changes endpoint, apiKey, enabled, events, pluginData and updates without rebuilding the plugin — to rotate the tenant’s API key, switch tracking off or send less. Other settings in it are ignored. Overrides are applied in this order, each over the one before:

  1. plugboard-tracking.override.json next to the plugin DLL or EXE;
  2. %ProgramData%\<Company>\Plugboard.Tracking\plugboard-tracking.override.json, so a PC’s administrator has the last word.

<Company> is the tracked assembly’s company (<Company> in the project file, AssemblyCompany attribute).

Common uses:

Goal Override file Where
Rotate the tenant’s API key without a new plugin release { "apiKey": "aut_new_key" } next to the DLL (deployed with the plugin’s files), or in %ProgramData% on each PC
Switch tracking off on one PC or for a whole company { "enabled": false } %ProgramData%\<Company>\Plugboard.Tracking\ (e.g. deployed by the customer’s IT)
Send less { "events": { "button_clicked": false, "form_opened": false }, "pluginData": { "enabled": false } } either
No update notifications (e.g. IT deploys new versions centrally) { "updates": { "enabled": false } } %ProgramData%\<Company>\Plugboard.Tracking\
Point to another server (e.g. testing) { "endpoint": "https://test-server/api/usage-events", "apiKey": "aut_test_key" } next to the DLL

Changes apply when the plugin or tool starts next. An invalid override file changes nothing and is reported in the log.

Field From
tool_name toolName, or the assembly name
user_name Environment.UserName
pc_name Environment.MachineName
event_name the event
occurred_at when it happened
data.tool_version the assembly’s informational version (without +build metadata), else file or assembly version
data.file_hash the SHA-256 of the DLL or EXE (lower-case hex), so the server knows the exact build each user and PC runs
data.tekla_version the Tekla Structures version when running inside Tekla or with Tekla’s API loaded
data.session_id a new ID per process and tool
data.account_id, data.account_email the user logged in with the login library, when the plugin uses it
PlugboardTracker.Track("export_done", new { files = 12, format = "IFC" });
  • data is an anonymous object, any object (its public properties and fields) or a dictionary. It becomes the event’s JSON data. Tool, user, PC, Tekla version and session are added automatically.
  • The event belongs to the calling assembly’s tool. When that assembly isn’t tracked (e.g. a shared helper library) and exactly one tool is tracked in the process, it goes to that tool; otherwise it’s dropped.
  • Custom events follow events.custom, events.customAllowList and events.customDenyList.
  • Data larger than the API’s 16 KB limit is cut: the largest values are left out, dataTruncated: true is added and a warning is logged. Names longer than 255 characters are cut.
  • PlugboardTracker.Enabled = false stops all tracking in the process at run time (e.g. when the user opts out); true resumes it. PlugboardTracker.ForAssembly(assembly)?.IsEnabled tells whether one tool is tracked.

When the plugin also uses Plugboard.Authenticate.Client (this repo’s login library) through its Auth class and the user is logged in, every event’s data also has account_id and account_email. The packages stay independent: tracking reads Auth.CurrentUser only when the login library is loaded.

A standalone EXE (WinForms, WPF or console) needs no code at all: when the tracked assembly is the process’s entry assembly, it sends

Event When Data
application_started the EXE starts —
application_closed the EXE exits durationMs (session length), crashed: true after a crash
unhandled_exception an exception nobody handled see below

Unhandled exceptions are caught from AppDomain.UnhandledException, TaskScheduler.UnobservedTaskException, and on .NET Framework from WinForms’ Application.ThreadException and WPF’s Dispatcher.UnhandledException (only for the UI framework the EXE references). The handlers only observe; they never mark an exception handled:

  • WPF: the tool’s own DispatcherUnhandledException handling is unchanged.
  • WinForms: .NET Framework allows one ThreadException handler per thread. Tracking sets one before Main runs. If the tool sets its own, the tool’s replaces tracking’s, so the tool’s handling wins (and UI thread exceptions are then not tracked). Otherwise tracking shows WinForms’ standard error dialog (Continue / Quit), as WinForms does by default.
  • Crash: when an exception ends the process, unhandled_exception and application_closed are flushed first (best effort, 2 seconds).

Inside Tekla (any assembly that isn’t the entry assembly) only the AppDomain and task exceptions are watched, and only exceptions with a method of the plugin’s own assembly on the stack are reported, so Tekla’s own errors aren’t. Tekla’s WinForms and WPF exception handling is never touched, and there are no application_* events.

unhandled_exception data:

Field Meaning
exceptionType, message the exception (message cut to 1000 characters)
innerExceptionType, innerMessage the innermost exception, when there is one
fingerprint a hash of the type and the methods on the stack (no line numbers or paths): the same error at the same place has the same fingerprint, across users and builds
topFrames the top 5 methods of the stack, as Namespace.Type.Method
source AppDomain, Task, WinForms or Dispatcher
isTerminating whether the exception ended the process
Event Default Data
form_opened on formName (the form or window class name)
form_closed off formName, durationMs (how long it was open)
button_clicked on controlName (Name / x:Name, else the automation ID or accessible name), text (the caption without access keys), formName

"forms": true|false in events switches both form events, "buttons": true|false the button event.

  • WPF (standalone tools and Tekla plugins that reference WPF): every window and every button and menu item click is seen by class handlers. Each belongs to the tool whose assembly defines the window, or the user control or panel the button is in, so in Tekla only the plugin’s own dialogs are tracked.
  • WinForms: standalone tools find their forms automatically. Tekla plugin dialogs call TeklaTracking.TrackDialog(this) (Plugboard.Tracking.Tekla). Buttons, tool strip buttons, menu items and controls added later are tracked.
  • Not tracked: check boxes, radio buttons, repeat buttons, buttons that are part of a control’s template (combo box arrows, scroll bars), menu items that open a submenu, and tool strip text boxes and combo boxes.
  • includeButtons and excludeButtons match the control name or the text, ignoring case, with * and ? wildcards. When includeButtons isn’t empty, only matching buttons are tracked; excludeButtons is applied after it, so a button in both lists isn’t tracked.
  • The same button is tracked at most 5 times per second.
  • Privacy: only that a button was clicked is recorded, never what is typed into text boxes or other input fields.

Every tracked plugin and tool checks whether a newer published version is available and, if so, shows a small notification at the bottom right of the screen:

Rebar Exporter 3.2.0 is available – you have 3.1.2 [Download] [What’s new] [Remind me later] [Skip this version]

  • Download opens the download link in the default browser. Nothing is installed automatically.
  • What’s new shows the release notes.
  • Remind me later hides this version for 7 days; Skip this version hides it for good. Both are kept per Windows user in %LocalAppData%\<Company>\Plugboard.Tracking\updates\.
  • Closing the notification hides it until the next check.

How it works:

  • The check runs in the background, 15 seconds after the tool loads, and then at most once per updates.checkIntervalHours (default once a day) per tool and Windows user, across all its processes. It never delays the tool’s start.
  • It asks GET /api/app-updates/check next to the usage events endpoint (https://your-app/api/usage-events → https://your-app/api/app-updates/check) with the tenant API key. The server recognises the running version by file_hash, so the plugin needs no login.
  • With the login library (Plugboard.Authenticate.Client), the server already answers when it checks the stored login (Auth.LatestUpdate). That answer is used as soon as it arrives, even between checks, without asking again.
  • The notification never takes the focus, has no owner window and doesn’t block the tool or Tekla. Each version is shown at most once per session.
  • If the check fails (offline, server error, unknown build), nothing is shown and nothing is thrown; it’s tried again an hour later. Problems go to the log.
  • Turn it off with "updates": { "enabled": false }, also in an override file. It doesn’t depend on enabled, which only switches usage events. It’s shown only in .NET Framework tools running in an interactive session.

Events (they follow the events switches like any other):

Event When Data
update_notified the notification was shown currentVersion, latestVersion
update_download_clicked Download was clicked currentVersion, latestVersion
update_skipped Skip this version was clicked currentVersion, latestVersion

Events are queued in memory and sent in batches (at most 500 per request) on a background thread every flushIntervalSeconds; the first batch goes out 5 seconds after the first event. Tracked plugins with the same endpoint and API key share batches. Tracking never waits for the network, and the HTTP timeout is 10 seconds.

The API answers What happens
2xx Sent.
No answer, timeout, 408, 429, 5xx The events are saved to the offline buffer and sent again later. The wait doubles after each failure (30 s, 1 min, 2 min, … up to 1 hour), or follows the server’s Retry-After.
422 The events the API named as invalid are dropped (logged); the rest are sent again.
Other 4xx The batch is dropped (logged).
401, 403 The API key is invalid, revoked or expired. Sending to that endpoint stops until the next start; the events are kept and saved on exit.
404 The endpoint is wrong. Handled like 401.

Offline buffer: unsent events are saved in %LocalAppData%\<Company>\Plugboard.Tracking\queue\ and sent on the next start or once the connection is back — also by another process of the same user. Saved events are kept per endpoint and go out with the current API key, so events from before a key rotation still arrive. The buffer is limited to 10 MB per endpoint (the oldest events are dropped first), and the memory queue to 10,000 events.

On exit (process exit, Tekla closing) a last flush runs for at most 2 seconds; what’s left is saved for the next start.

Tracking writes its problems (invalid config, failed sends, rejected API key) to %LocalAppData%\<Company>\Plugboard.Tracking\logs\plugboard-tracking.log (rolled over at 1 MB, one older file plugboard-tracking.1.log is kept).

Log message Fix
The API key was rejected … Set a valid apiKey, e.g. in plugboard-tracking.override.json.
The usage events API was not found … Check endpoint.
Sending to … failed (no response …) No connection; the events are saved and sent later.
tracking is off: 'endpoint' is not set. Fill in plugboard-tracking.json and rebuild, or set it in an override file.
The assembly has no embedded plugboard-tracking.json The build didn’t embed it: check the build warnings (UT001–UT004) and that the project references the package.
… rejected N invalid event(s) … The API refused some events (e.g. data too large); the log shows the API’s reason.

More checks:

  • No events and no log file: tracking didn’t start. Look for build warning UT004 (C# older than 9) and make sure the module initializer isn’t switched off (PlugboardTrackingModuleInitializer). Tekla plugins on the tracked base classes start tracking even without it.
  • Events arrive late: they’re sent every flushIntervalSeconds. While the API is unreachable they wait in the offline buffer, %LocalAppData%\<Company>\Plugboard.Tracking\queue\ (one *.events.json file per failed send), and go out once it’s reachable again.
  • Which settings apply: the log’s tracking as '<tool>' <version>, on|off line, and an Applied <file> line for each override file.

All events have tool_name, user_name, pc_name, event_name, occurred_at, and in data the context tool_version, file_hash, tekla_version, session_id (plus account_id and account_email with the login library).

Event Default Sent by Event data
plugin_loaded on every tracked assembly when it loads —
plugin_run_started off TeklaTracking.Run inputCount, pluginData, pluginDataTruncated
plugin_run_completed on TeklaTracking.Run durationMs, success, inputCount, exceptionType, exceptionMessage, pluginData, pluginDataTruncated
application_started on standalone tools —
application_closed on standalone tools durationMs, crashed
form_opened on WinForms forms, WPF windows formName
form_closed off WinForms forms, WPF windows formName, durationMs
button_clicked on buttons, tool strip and menu items controlName, text, formName
unhandled_exception on standalone tools; plugins for their own exceptions exceptionType, message, innerExceptionType, innerMessage, fingerprint, topFrames, source, isTerminating
update_notified on the update notification currentVersion, latestVersion
update_download_clicked on the update notification currentVersion, latestVersion
update_skipped on the update notification currentVersion, latestVersion
custom (any other name) on (events.custom) PlugboardTracker.Track your data

Any event’s data may have dataTruncated: true when it was cut to the API’s 16 KB limit.