{"id":15750325,"url":"https://github.com/nwtgck/google-analytics-injector-npm","last_synced_at":"2025-02-28T08:39:24.903Z","repository":{"id":48452719,"uuid":"173547256","full_name":"nwtgck/google-analytics-injector-npm","owner":"nwtgck","description":"CLI for injecting Google Analytics Tracking Snippet to HTML files","archived":false,"fork":false,"pushed_at":"2021-07-25T16:45:56.000Z","size":412,"stargazers_count":2,"open_issues_count":16,"forks_count":1,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-02-04T01:17:07.990Z","etag":null,"topics":["google-analytics","injection","injector","insert","javascript","tracking-id","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/nwtgck.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":"2019-03-03T08:04:21.000Z","updated_at":"2023-10-11T14:28:25.000Z","dependencies_parsed_at":"2022-09-04T23:01:49.494Z","dependency_job_id":null,"html_url":"https://github.com/nwtgck/google-analytics-injector-npm","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fgoogle-analytics-injector-npm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fgoogle-analytics-injector-npm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fgoogle-analytics-injector-npm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fgoogle-analytics-injector-npm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nwtgck","download_url":"https://codeload.github.com/nwtgck/google-analytics-injector-npm/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241125015,"owners_count":19913839,"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":["google-analytics","injection","injector","insert","javascript","tracking-id","typescript"],"created_at":"2024-10-04T06:40:20.716Z","updated_at":"2025-02-28T08:39:24.873Z","avatar_url":"https://github.com/nwtgck.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-analytics-injector\n[![npm](https://img.shields.io/npm/v/google-analytics-injector.svg)](https://www.npmjs.com/package/google-analytics-injector) [![CircleCI](https://circleci.com/gh/nwtgck/google-analytics-injector-npm.svg?style=shield)](https://circleci.com/gh/nwtgck/google-analytics-injector-npm)\n\nInject Google Analytics Tracking Snippet\n\n## Installation\n\nInstall `google-analytics-injector` command as follows.\n\n```bash\nnpm i -g google-analytics-injector\n```\n\n## Usage\n\nSuppose your have `myfile.html` as follows.\n\n```html\n\u003c!-- myfile.html --\u003e\n\u003cbody\u003e\n  \u003ch1\u003eMy File\u003c/h1\u003e\n\u003c/body\u003e\n```\n\nType the following command to inject tracking ID, `\"UA-XXXXX-Y\"` to `myfile.html`.\n\n```bash\ngoogle-analytics-injector -t UA-XXXXX-Y myfile.html\n```\n\nThen, you have injected `myfile.html` as follows.\n\n```html\n\u003c!-- myfile.html --\u003e\u003chtml\u003e\u003chead\u003e\u003c!-- Google Analytics --\u003e\n\u003cscript\u003e\n(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n\nga('create', 'UA-XXXXX-Y', 'auto');\nga('send', 'pageview');\n\u003c/script\u003e\n\u003c!-- End Google Analytics --\u003e\u003c/head\u003e\u003cbody\u003e\n\u003ch1\u003eMy File\u003c/h1\u003e\n\u003c/body\u003e\u003c/html\u003e\n```\n\n### Inject recursively\n\nSuupose `mydist` is a directory which contains .html files. The files injected recursively. \n\n```bash\ngoogle-analytics-injector -t UA-XXXXX-Y ./mydist/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Fgoogle-analytics-injector-npm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnwtgck%2Fgoogle-analytics-injector-npm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Fgoogle-analytics-injector-npm/lists"}