{"id":26663169,"url":"https://github.com/startpolymer/start-google-analytics-tracker","last_synced_at":"2026-01-05T16:45:14.524Z","repository":{"id":58245294,"uuid":"41486129","full_name":"StartPolymer/start-google-analytics-tracker","owner":"StartPolymer","description":null,"archived":false,"fork":false,"pushed_at":"2016-06-15T05:09:22.000Z","size":128,"stargazers_count":5,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T23:07:04.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/StartPolymer.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":"2015-08-27T12:46:49.000Z","updated_at":"2018-02-22T13:48:00.000Z","dependencies_parsed_at":"2022-08-31T04:50:38.614Z","dependency_job_id":null,"html_url":"https://github.com/StartPolymer/start-google-analytics-tracker","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartPolymer%2Fstart-google-analytics-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartPolymer%2Fstart-google-analytics-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartPolymer%2Fstart-google-analytics-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartPolymer%2Fstart-google-analytics-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StartPolymer","download_url":"https://codeload.github.com/StartPolymer/start-google-analytics-tracker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245476694,"owners_count":20621699,"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":[],"created_at":"2025-03-25T14:20:11.111Z","updated_at":"2026-01-05T16:45:14.483Z","avatar_url":"https://github.com/StartPolymer.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# start-google-analytics-tracker\n\n`start-google-analytics-tracker` is a Polymer Element for [Google Analytics Web Tracking](https://developers.google.com/analytics/devguides/collection/analyticsjs/), supports page and event tracking.\n\nScript analytics.js is served from local `scripts` dir, because https://www.google-analytics.com/analytics.js have only 2 hours cache.\n\nYou need download latest analytics.js file.\n\n```sh\nwget https://www.google-analytics.com/analytics.js -O scripts/analytics.js\n```\n\nInspired by this repo https://github.com/matthewlawson/google-analytics-universal-tracker\n\n## Getting Started\n\n### Installation\n\n```sh\nbower install start-google-analytics-tracker --save\n```\n\n### Usage\n\n#### Initialise\n\n```html\n\u003clink rel=\"import\" href=\"bower_components/start-google-analytics-tracker/start-google-analytics-tracker.html\"\u003e\n\n\u003cstart-google-analytics-tracker code=\"UA-XXXXX-Y\"\u003e\u003c/start-google-analytics-tracker\u003e\n```\n\nIf you are using regular anchor links and not push-state links you are ready to go!\n\nIf you have a Single Page Application that uses push-state, eg with `page.js` or `\u003capp-router\u003e` you will need to signal to the `start-google-analytics-tracker` element that the page has changed.\n\nThe Page Change events are handled using iron-signals so you do not need to do any dom finding to trigger a page track.\n\n#### Track a page Change\n\n```javascript\n    this.fire('iron-signal', {name: 'track-page', data: { path: \"/about.html\" } });\n```\n\n#### Track an Event\n\n```javascript\n    this.fire('iron-signal', {name: 'track-event',data: {category: \"messages\",action: \"send_text_message\",label: \"group\",value: 1}});\n```\n\n#### User id attribution\n\nTo use [Google Analytics user id attribution](https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id) set the user id property on the element:\n\n```javascript\n    document.querySelector(\"start-google-analytics-tracker\").userId = loggedInUserId;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartpolymer%2Fstart-google-analytics-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstartpolymer%2Fstart-google-analytics-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartpolymer%2Fstart-google-analytics-tracker/lists"}