{"id":42691812,"url":"https://github.com/luileito/evtrack","last_synced_at":"2026-01-29T13:05:22.415Z","repository":{"id":3464662,"uuid":"4519041","full_name":"luileito/evtrack","owner":"luileito","description":"Event tracking on websites","archived":false,"fork":false,"pushed_at":"2022-07-31T15:35:12.000Z","size":97,"stargazers_count":56,"open_issues_count":0,"forks_count":27,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-16T10:22:24.344Z","etag":null,"topics":["browser-events","event-tracker","mouse-tracking","web-browsing"],"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/luileito.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license/lgpl.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-01T11:43:05.000Z","updated_at":"2023-12-16T13:52:09.000Z","dependencies_parsed_at":"2022-08-06T14:00:54.929Z","dependency_job_id":null,"html_url":"https://github.com/luileito/evtrack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luileito/evtrack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luileito%2Fevtrack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luileito%2Fevtrack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luileito%2Fevtrack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luileito%2Fevtrack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luileito","download_url":"https://codeload.github.com/luileito/evtrack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luileito%2Fevtrack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28877889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["browser-events","event-tracker","mouse-tracking","web-browsing"],"created_at":"2026-01-29T13:05:11.686Z","updated_at":"2026-01-29T13:05:22.407Z","avatar_url":"https://github.com/luileito.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# evtrack\n\nEvent tracking on websites using plain old JavaScript.\nNo third-party libraries or external dependencies. :smiley:\n\n## Usage\n\n* For web pages:\n  Just add `load.min.js` to your page (e.g. inside `\u003chead\u003e` element or right before the closing `\u003c/body\u003e` tag) and configure tracking options.\n\n* For browser extensions:\n  Add `tracklib.min.js` and `trackui.min.js` (in this order) to your `manifest.json` (or similar) and configure tracking options.\n\n### Example 1\n\nDefault configuration.\nCapture [any](https://github.com/luileito/evtrack/blob/master/js/src/trackui.js#L6) browser event whenever it happens.\n\n```javascript\n\u003cscript src=\"/path/to/load.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n(function(){\n\n  TrackUI.record({\n    // Remember to point to save.php (or similar) to write the log files.\n    postServer: \"/path/to/save.php\"\n  });\n\n})();\n\u003c/script\u003e\n```\n\n### Example 2\n\nCapture all mouse clicks whenever they happen.\nAlso capture every mouse movement at 50 ms.\nAll other browser events are ignored.\n\n```javascript\n\u003cscript src=\"/path/to/load.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n(function(){\n\n  TrackUI.record({\n    postServer: \"/path/to/save.php\",\n    regularEvents: \"click\",\n    pollingEvents: \"mousemove\",\n    pollingMs: 50,\n  });\n\n})();\n\u003c/script\u003e\n```\n\n### Example 3\n\nCapture any browser event every 500 ms.\n\n```javascript\n\u003cscript src=\"/path/to/load.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n(function(){\n\n  TrackUI.record({\n    postServer: \"/path/to/save.php\",\n    regularEvents: \"\",\n    pollingEvents: \"*\",\n    pollingMs: 500,\n  });\n\n})();\n\u003c/script\u003e\n```\n\n### Example 4\n\nUse the default settings within a Chrome extension:\n\n1. Add the following snippet to your `manifest.json` file:\n\n```javascript\n\"content_scripts\": [{\n  \"js\": [\n    \"path/to/evtrack/tracklib.min.js\",\n    \"path/to/evtrack/trackui.min.js\",\n    \"main.js\"\n  ]\n}],\n```\n\n2. Add `TrackUI.record(settings)` in `main.js`, where `settings` holds your tracking options.\n\n\n## Default tracking settings\n\nThe `settings` object has the following defaults:\n\n```javascript\nTrackUI.record({\n  // The server where logs will be stored.\n  postServer: \"//my.server.org/save.script\",\n  // The interval (in seconds) to post data to the server.\n  postInterval: 30,\n  // Events to be tracked whenever the browser fires them. Default:\n  //      mouse-related: \"mousedown mouseup mousemove mouseover mouseout mousewheel click dblclick\"\n  //      touch-related: \"touchstart touchend touchmove\"\n  //   keyboard-related: \"keydown keyup keypress\"\n  //     window-related: \"load unload beforeunload blur focus resize error online offline\"\n  //             others: \"scroll change select submit reset contextmenu cut copy paste\"\n  // If this property is empty, no events will be tracked.\n  // Use space-separated values to indicate multiple events, e.g. \"click mousemove touchmove\".\n  // The \"*\" wildcard can be used to specify all events.\n  regularEvents: \"*\",\n  // Events to be polled, because some events are not always needed (e.g. mousemove).\n  // If this property is empty (default value), no events will be polled.\n  // Use space-separated values to indicate multiple events, e.g. \"mousemove touchmove\".\n  // The \"*\" wildcard can be used to specify all events.\n  // Events in pollingEvents will override those specified in regularEvents.\n  // You can leave regularEvents empty and use only pollingEvents, if need be.\n  pollingEvents: \"\",\n  // Sampling frequency (in ms) to register events.\n  // If set to 0, every single event will be recorded.\n  pollingMs: 150,\n  // A name that identifies the current task.\n  // Useful to filter logs by e.g. tracking campaign ID.\n  taskName: \"evtrack\",\n  // A custom function to execute on each recording tick.\n  callback: null,\n  // Whether to dump element attributes together with each recorded event.\n  saveAttributes: true,\n  // Enable this to display some debug information\n  debug: false\n})\n```\n\n### Result\n\nFor each browsed page, you'll have in the `logs` directory the following files:\n\n1. A space-delimited CSV-like file with 8 columns.\n2. An XML file with some metadata.\n\n#### CSV file example\n\n```csv\ncursor timestamp xpos ypos event xpath attrs extras\n0 1405503114382 0 0 load / {}\n```\nWhere:\n* The `cursor` column indicates the cursor ID.\n  Will be `0` for a regular computer mouse, or an integer indicating the finger ID for touch-capable browsers.\n* The `timestamp` column indicates the timestamp of the event, with millisecond precision.\n* The `xpos` and `ypos` columns indicate the `x` and `y` position of the cursor, respectively.\n  For events that do *not* relate to any mouse event (e.g. `load` or `blur`), these values will be `0`.\n* The `event` column indicates the browser's event name.\n* The `xpath` column indicates the target element that relates to the event, [in XPath notation](https://en.wikipedia.org/wiki/XPath).\n* The `attrs` column indicates the element attributes, if any.\n* The `extras` column is populated with the result of the `callback` setting you've set.\n\n#### XML file example\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cdata\u003e\n \u003cip\u003e127.0.0.1\u003c/ip\u003e\n \u003cdate\u003eWed, 16 Jul 2014 11:32:24 +0200\u003c/date\u003e\n \u003curl\u003ehttp://localhost/evtrack/test.html\u003c/url\u003e\n \u003cua\u003eMozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36\u003c/ua\u003e\n \u003cscreen\u003e1600x900\u003c/screen\u003e\n \u003cwindow\u003e1551x548\u003c/window\u003e\n \u003cdocument\u003e1551x548\u003c/document\u003e\n \u003ctask\u003eevtrack\u003c/task\u003e\n\u003c/data\u003e\n```\n\nThe `\u003ctask /\u003e` element is the value you've set in the `taskName` setting.\nThis is useful to annotate a particular tracking campaign's ID, an experimental user group, etc.\n\n## Citation\n\nIf you use this software in any academic project, please cite it as:\n\n* Leiva, L.A. and Vivó, R. Web Browsing Behavior Analysis and Interactive Hypervideo. _ACM Transactions on the Web_ **7**(4), 2013.\n```bibtex\n@Article{Leiva13-tweb,\n author   = {Luis A. Leiva and Roberto Viv\\'o},\n title    = {Web Browsing Behavior Analysis and Interactive Hypervideo},\n journal  = {ACM Transactions on the Web},\n volume   = {7},\n number   = {4},\n year     = {2013},\n}\n```\n\n## License\n\nThis software is dual-licensed under the MIT and LGPL v3 licenses.\nSee the [license](https://github.com/luileito/evtrack/blob/master/license) dir.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluileito%2Fevtrack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluileito%2Fevtrack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluileito%2Fevtrack/lists"}