API

API

Methods

(async, static) insertGtagCode(dirPath, trackingId, optionsopt)

Source:

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

Parameters:
Name Type Attributes Description
dirPath string

A directory path

trackingId string | Array.<string>

A tracking ID(s)

options object <optional>

See API.listFilesToAdd

(async, static) insertGTagManagerCode(dirPath, gtmId, optionsopt)

Source:

Insert Google Tag Manager code in html files. Set up (web) Google Tag Manager

Parameters:
Name Type Attributes Description
dirPath string

A directory path

gtmId string

A GTM ID

options object <optional>

See API.listFilesToAdd

(static) makeAnalyticsCode(trackingId, indentNumopt) → {string}

Source:

Makes Google Analytics html code (gtag.js). Set up (web) Google Analytics

Parameters:
Name Type Attributes Default Description
trackingId string | Array.<string>

A tracking ID(s)

indentNum string <optional>
4

Number of indenting white spaces.

Returns:
  • A Google Analytics html code
Type
string

(static) makeTagManagerCode(gtmId, indentNumopt) → {string}

Source:

Makes Google Tag Manager html code. Google Tag Manager

Parameters:
Name Type Attributes Default Description
gtmId string

A GTM ID

indentNum string <optional>
4

Number of indenting white spaces.

Returns:
  • A Google Tag Manager html code
Type
string

(static) makeTagManagerCodeNoScript(gtmId, indentNumopt) → {string}

Source:

Makes Google Tag Manager html code for noscript.

Parameters:
Name Type Attributes Default Description
gtmId string

A GTM ID

indentNum string <optional>
4

Number of indenting white spaces.

Returns:
  • A Google Tag Manager html code for noscript
Type
string