{"id":24383446,"url":"https://github.com/firstandthird/ga-nav-tracker","last_synced_at":"2025-09-13T12:20:42.945Z","repository":{"id":32984412,"uuid":"147576493","full_name":"firstandthird/ga-nav-tracker","owner":"firstandthird","description":"Auto-track link clicks for Google Analytics","archived":false,"fork":false,"pushed_at":"2022-12-08T20:51:06.000Z","size":1402,"stargazers_count":1,"open_issues_count":14,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-04T09:40:24.105Z","etag":null,"topics":["front-end","tracking"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ga-nav-tracker","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/firstandthird.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}},"created_at":"2018-09-05T20:35:47.000Z","updated_at":"2023-06-13T05:23:13.000Z","dependencies_parsed_at":"2023-01-14T22:56:01.702Z","dependency_job_id":null,"html_url":"https://github.com/firstandthird/ga-nav-tracker","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fga-nav-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fga-nav-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fga-nav-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fga-nav-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firstandthird","download_url":"https://codeload.github.com/firstandthird/ga-nav-tracker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243259022,"owners_count":20262381,"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","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":["front-end","tracking"],"created_at":"2025-01-19T10:14:29.826Z","updated_at":"2025-03-12T17:20:46.544Z","avatar_url":"https://github.com/firstandthird.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Analytics Nav Tracker (ga-nav-tracker)\n\n[![Build Status](https://travis-ci.org/firstandthird/ga-nav-tracker.svg?branch=master)](https://travis-ci.org/firstandthird/ga-nav-tracker)\n![npm](https://img.shields.io/npm/v/ga-nav-tracker.svg)\n\nAuto-track link clicks for Google Analytics.\n\n\u003e This library uses [ga-track](https://github.com/firstandthird/ga-track) and needs [Google Analytics](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to be set up in order to work.\n\n## Installation\n\n```sh\nnpm install ga-nav-tracker\n```\n\n## Usage\n\n```js\nimport GANavTracker from 'ga-nav-tracker'\n```\n\n### init()\n\nInitializes library and all link clicks within the specified tag will be tracked in Google Analytics.\n\n## Example [(see example)](example/index.html)\n\nAdd `data-nav-tracker=\"header|footer\"` to any element and the library will track link clicks.\n\n```html\n\u003cnav\u003e\n  \u003cul data-nav-tracker=\"header\"\u003e\n    \u003cli\u003e\u003ca href=\"#\"\u003eLink 1\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#\"\u003eLink 2\u003c/a\u003e\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/nav\u003e\n```\n\nClicking on the first link will be send this object to Google Analytics:\n\n```js\n{\n  action: 'header'\n  label: 'Link 1'\n  category: 'nav-tracker'\n}\n```\n\nYou can optionally set `data-nav-tracker-dropdown`, which prepends tracker location to the label property. See the example below:\n\n```html\n\u003cnav\u003e\n  \u003cul data-nav-tracker=\"header\"\u003e\n    \u003cli\u003e\u003ca href=\"#\"\u003eLink 1\u003c/a\u003e\u003c/li\u003e\n    ...\n    \u003cli data-nav-tracker-dropdown=\"Dropdown\"\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#\"\u003eLink 2\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/nav\u003e\n```\n\nClicking on the second link will send this object to Google Analytics:\n\n```js\n{\n  action: 'header'\n  label: 'Dropdown - Link 2'\n  category: 'nav-tracker'\n}\n```\n\n## License\n\n### MIT License\n\nCopyright (c) 2019 First+Third\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fga-nav-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirstandthird%2Fga-nav-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fga-nav-tracker/lists"}