{"id":20202852,"url":"https://github.com/confusedmatrix/visibility-stats","last_synced_at":"2026-06-11T07:31:43.629Z","repository":{"id":145250614,"uuid":"112348816","full_name":"confusedmatrix/visibility-stats","owner":"confusedmatrix","description":"A simple library to determine if DOM elements are visible in the viewport and statistics about how long elements have been visible / when they were last visible","archived":false,"fork":false,"pushed_at":"2017-11-28T15:01:03.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-03T09:16:25.034Z","etag":null,"topics":["dom","usability","visibility"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/confusedmatrix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-11-28T14:53:28.000Z","updated_at":"2017-11-28T22:02:09.000Z","dependencies_parsed_at":"2023-04-14T06:07:33.465Z","dependency_job_id":null,"html_url":"https://github.com/confusedmatrix/visibility-stats","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/confusedmatrix/visibility-stats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confusedmatrix%2Fvisibility-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confusedmatrix%2Fvisibility-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confusedmatrix%2Fvisibility-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confusedmatrix%2Fvisibility-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/confusedmatrix","download_url":"https://codeload.github.com/confusedmatrix/visibility-stats/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confusedmatrix%2Fvisibility-stats/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34188272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"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":["dom","usability","visibility"],"created_at":"2024-11-14T04:58:35.567Z","updated_at":"2026-06-11T07:31:43.598Z","avatar_url":"https://github.com/confusedmatrix.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VisibilityStats\nA simple library to determine if DOM elements are visible in the \nviewport and statistics about how long elements have been visible \n/ when they were last visible.\n\nThis library could be useful for determining which content is most\nlooked at on a page and therefore could be a measure of how good/useful \na particular content section is.\n\n## Intallation\nIn the browser:\n```\n\u003cscript src=\"visibility-stats.min.js\"\u003e\n```\n\nVia npm\n```shell\nnpm i --save visibility-stats\n```\n\n## Usage\n\nSample HTML\n```html\n\u003cdiv id=\"watch-me\"\u003e\u003c/div\u003e\n\u003cdiv id=\"watch-me-too\"\u003e\u003c/div\u003e\n```\n\n\n```html\n\u003cscript\u003e\n// Initialise the library with a DOM query selector to \n// begin tracking the visibily of certain elements\nvar vs = new VisibilityStats(\"#watch-me, #watch-me-too\")\n\n// return all currently visible elements\nvs.getVisibleElements()\n\n// get up to date stats on which elements are visible and how \n// long they have been visible for / when they were last visible\nvs.getStats()\n\u003c/script\u003e\n```\n\nFor more examples, see the `/examples` directory\n\n## Build devlopment bundle\n`yarn build:dev`\n\nor to additional watch for changes and rebuild bundle\n`yarn build:dev:watch`\n\n## Compile production library to dist\n`yarn build:prod`\n\n## Run tests (TBD)\n`yarn test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfusedmatrix%2Fvisibility-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconfusedmatrix%2Fvisibility-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfusedmatrix%2Fvisibility-stats/lists"}