{"id":22891649,"url":"https://github.com/hanford/website-performance-hoc","last_synced_at":"2026-04-29T19:02:53.480Z","repository":{"id":66328763,"uuid":"124925999","full_name":"hanford/website-performance-hoc","owner":"hanford","description":"react bindings for the website-performance NPM module","archived":false,"fork":false,"pushed_at":"2018-03-15T20:18:16.000Z","size":354,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-01T04:42:57.774Z","etag":null,"topics":["domcontentloaded","hoc","performance","react","segment","tracking","tti"],"latest_commit_sha":null,"homepage":null,"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/hanford.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-12T17:27:42.000Z","updated_at":"2024-04-25T09:04:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"418f25c5-71b5-4393-a227-d0b31e7e3def","html_url":"https://github.com/hanford/website-performance-hoc","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/hanford/website-performance-hoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fwebsite-performance-hoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fwebsite-performance-hoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fwebsite-performance-hoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fwebsite-performance-hoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hanford","download_url":"https://codeload.github.com/hanford/website-performance-hoc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanford%2Fwebsite-performance-hoc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32439301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T18:12:22.909Z","status":"ssl_error","status_checked_at":"2026-04-29T18:11:33.322Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["domcontentloaded","hoc","performance","react","segment","tracking","tti"],"created_at":"2024-12-13T22:35:15.980Z","updated_at":"2026-04-29T19:02:53.460Z","avatar_url":"https://github.com/hanford.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# website-performance-hoc\n\n[![npm package][npm-badge]][npm]\n\nWrap react components with a HOC measuring page performance metrics. This packages assumes you're tracking via segment and is simply providing a react-y HOC implementation of the [website-performance](https://github.com/hanford/website-performance) npm module.\n\n[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square\n[npm]: https://www.npmjs.org/package/npm-package\n\n## Usage\n\nIf you've loaded segment globally, and are guranteed to have window.analytics defined before your code runs .. integrating is as easy as:\n```js\nimport withPerformance from 'website-performance-hoc'\n\nclass MyPage extends React.PureComponent {\n  ...\n}\n\nexport default withPerformance(window.analytics)(MyPage, { eventName: 'Performance.Track' })\n```\n\nIn other cases, you may have asynchronously loaded a tracking library. Integrating would then look something like this:\n\n```js\nimport withPerformance from 'website-performance-hoc'\nimport Segment from 'load-segment'\nconst analytics = Segment({ key: .. })\n\nclass MyPage extends React.PureComponent {\n  ...\n}\n\nexport default withPerformance(analytics)(MyPage)\n```\n\n`website-performance-hoc` can take any analytics provider as long as it has a `.track()` method, so it should work with Google analytics and Segment. If you're using an analytics provider that doesn't have a `.track()` method, please [open an issue](https://github.com/hanford/website-performance-hoc/issues/new).\n\nWe're using `componentDidMount` in the `HOC` which can be invoked before the `DOM` has loaded. In that case, we set `window.onload` to retry tracking once the window has loaded. We're also deferring the track call to when the browser has free cycles using [request-callback](https://github.com/hanford/request-callback).\n\n\nQuestions? Feedback? [Please let me know](https://github.com/hanford/website-performance-hoc/issues/new)\n\n## License (MIT)\n\n```\nWWWWWW||WWWWWW\n W W W||W W W\n      ||\n    ( OO )__________\n     /  |           \\\n    /o o|    MIT     \\\n    \\___/||_||__||_|| *\n         || ||  || ||\n        _||_|| _||_||\n       (__|__|(__|__|\n```\nCopyright © 2017-present [Jack Hanford](http://jackhanford.com), jackhanford@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanford%2Fwebsite-performance-hoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanford%2Fwebsite-performance-hoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanford%2Fwebsite-performance-hoc/lists"}