{"id":21497090,"url":"https://github.com/financial-times/n-tracking","last_synced_at":"2025-10-13T08:37:34.257Z","repository":{"id":39800935,"uuid":"179321925","full_name":"Financial-Times/n-tracking","owner":"Financial-Times","description":"Client-side tracking initialisation and custom events for FT.com","archived":false,"fork":false,"pushed_at":"2025-08-27T10:33:39.000Z","size":1184,"stargazers_count":8,"open_issues_count":30,"forks_count":1,"subscribers_count":44,"default_branch":"main","last_synced_at":"2025-08-27T19:52:50.031Z","etag":null,"topics":["customer-products","platforms-customer-products"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Financial-Times.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-04-03T15:47:50.000Z","updated_at":"2025-08-27T10:33:24.000Z","dependencies_parsed_at":"2023-12-30T03:28:04.390Z","dependency_job_id":"a3cc9b23-0140-4c9f-8126-3db937f4c329","html_url":"https://github.com/Financial-Times/n-tracking","commit_stats":{"total_commits":241,"total_committers":27,"mean_commits":8.925925925925926,"dds":0.7966804979253113,"last_synced_commit":"9ec5b9baa47c6dffdea1a801d0548ab0640bf846"},"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"purl":"pkg:github/Financial-Times/n-tracking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Fn-tracking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Fn-tracking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Fn-tracking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Fn-tracking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Financial-Times","download_url":"https://codeload.github.com/Financial-Times/n-tracking/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Fn-tracking/sbom","scorecard":{"id":50234,"data":{"date":"2025-08-11","repo":{"name":"github.com/Financial-Times/n-tracking","commit":"45d6bc08beea7a7a99c3edece4e5af7ab3b367d4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"13 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T23:35:10.231Z","repository_id":39800935,"created_at":"2025-08-14T23:35:10.232Z","updated_at":"2025-08-14T23:35:10.232Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014320,"owners_count":26085492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["customer-products","platforms-customer-products"],"created_at":"2024-11-23T16:21:28.917Z","updated_at":"2025-10-13T08:37:34.204Z","avatar_url":"https://github.com/Financial-Times.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @financial-times/n-tracking [![CircleCI](https://circleci.com/gh/Financial-Times/n-tracking/tree/main.svg?style=svg)](https://circleci.com/gh/Financial-Times/n-tracking/tree/main)\n\nThis package provides tracking initialisation and custom events for FT.com. On the client-side it configures [o-tracking] (which is used to capture and send tracking events to [Spoor]) and for the server-side it provides components which render fallback tracking pixels .\n\n[o-tracking]: https://github.com/Financial-Times/o-tracking\n[Spoor]: https://spoor-docs.herokuapp.com/\n\n\n## Getting started\n\nThis package is for client-side and server-side use and is distributed on npm.\n\n```sh\nnpm install -S @financial-times/n-tracking\n```\n\nAfter installing the package you can import the tracking component into your code:\n\n### Client-side integration\n\n**Configure [o-tracking]**\n\nThis package can be used on the client-side. Initialise the component with [configuration options](#options).\n\n```js\nimport * as nTracking from '@financial-times/n-tracking';\nconst options = {}\nconst oTracking = nTracking.init(options); \n```\n \n**Send custom events**\n\n```js\nimport * as nTracking from '@financial-times/n-tracking';\nconst context = { customData: 12345 }\nnTracking.broadcast('oTracking.event', {\n  category: 'page',\n  action: 'custom-event',\n  ...context\n});\n```\n\n### Server-side integration\n\nOn the server-side a JSX component embeds tracking pixels into the page which send page view events for any visitors which do not support JS or fail to cut the mustard.\n\n```jsx\nconst { CoreTracking } = require('@financial-times/n-tracking');\n\n\u003cCoreTracking {...options} /\u003e\n```\n\nTo initialise the component you'll need to provide it with several [configuration options](#options).\n\n\n## Client-side API\n\n### `init(options)`\n\nConfigures [o-tracking] with the given [options](#options), triggers a page view event, initialises click tracking, and returns the instance of [o-tracking].\n\n### `broadcast(name, data)`\n\nCreates a [`CustomEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent) with the given name and data and dispatches it from the document `\u003cbody\u003e` element. It is intended to be used to trigger `oTracking.event` events.\n\n### `trackers.{tracker}()`\n\nThere are several custom tracking features provided by this library. See the [docs folder](./docs) for more information about these.\n\n\n## Server-side API\n\n### `\u003cCoreTracking /\u003e`\n\nRenders a `\u003cnoscript\u003e` and inline `\u003cscript\u003e` element to embed fallback tracking pixels into the page which can be used when the client-side JS fails to run. It accepts the same [options](#options) as the client-side code.\n\n\n## Options\n\nProperty          | Type   | Required | Description\n------------------|--------|----------|------------------------------------------------------------------\n`appContext`      | Object | Yes      | [FT.com App Context] data describing the current page which will be appended to all captured events.\n`extraContext`    | Object | No       | Additional data describing the current page which will be appended to all captured events.\n`pageViewContext` | Object | No       | Additional data to append to the page view event only\n\n[FT.com App Context]: https://github.com/Financial-Times/dotcom-page-kit/blob/HEAD/packages/dotcom-server-app-context/schema.md\n\n\n## Automatically inferred data\n\n- Marketing query string parameters inc. cost-per-click and segment IDs\n- User data inc. layout, screen orientation, and connection type\n- Error page parameters inc. error code and error message\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinancial-times%2Fn-tracking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinancial-times%2Fn-tracking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinancial-times%2Fn-tracking/lists"}