google-analytics-injector
Inject Google Analytics Tracking Snippet
Installation
Install google-analytics-injector
command as follows.
npm i -g google-analytics-injector
Usage
Suppose your have myfile.html
as follows.
<!-- myfile.html --> My File
Type the following command to inject tracking ID, "UA-XXXXX-Y"
to myfile.html
.
google-analytics-injector -t UA-XXXXX-Y myfile.html
Then, you have injected myfile.html
as follows.
<!-- myfile.html --><!-- Google Analytics --><!-- End Google Analytics -->My File
Inject recursively
Suupose mydist
is a directory which contains .html files. The files injected recursively.
google-analytics-injector -t UA-XXXXX-Y ./mydist/