CLI

CLI

Source:

Below are the APIs of CLI (Command Line Interface). Some inappropriate titles are used because they are generated by JsDoc.

Methods

(static) analytics()

Source:
Example
Usage: insert-gtag analytics [options] <dirPath> <trackingId> [additionalId...]

Insert Google Analytics code (gtag.js) in html files

Options:
  -V, --version                output the version number
  -M, --matched-reg-exp <exp>  RegExp pattern of extensions of file to be inserted. Default.
                               "\.html?$"
  -I, --ignored-reg-exp <exp>  RegExp pattern of file to be exclude. Ex. "[_\-.]cache\d+"
  -N, --indents <number>       Number of indenting white spaces. Default: 4
  -h, --help                   display help for command

// Ex1.
> insert-gtag analytics "D:\MyHtmlDir" "UA-XXXXXX-Y"
done

// Ex2.
> insert-gtag analytics "D:\HtmlDir2" --indents 2 "UA-XXXXXX-Y" "AW-XXXXXXXXXX"
done

(static) tag-manager()

Source:
Example
Usage: insert-gtag tag-manager [options] <dirPath> <gtmId>

Insert Google Tag Manager code in html files

Options:
  -V, --version                output the version number
  -M, --matched-reg-exp <exp>  RegExp pattern of extensions of file to be inserted. Default.
                               "\.html?$"
  -I, --ignored-reg-exp <exp>  RegExp pattern of file to be exclude. Ex. "[_\-.]cache\d+"
  -N, --indents <number>       Number of indenting white spaces. Default: 4
  -h, --help                   display help for command

// Ex.
> insert-gtag tag-manager "D:\MyHtmlDir" "YOUR_GTM_ID"
done