Skip to content

Latest commit

 

History

History
23 lines (12 loc) · 1.38 KB

README.md

File metadata and controls

23 lines (12 loc) · 1.38 KB

Reading Time Calculator

Custom Variable Template for Google Tag Manager

Variable Template for calculating reading time for a text or DOM element content

Template Status Repo Size License


Usage

  • find your main content DOM element that contains all relevant content in your source code

  • create a DOM element variable that selects the main content element by ID or CSS selector. Tip: use document.querySelector in the console to check if your selector returns the right element

  • import this template and create a new variable using the template

  • reference the DOM element variable (or a text from any other source) in the first field, set reading speed and min value

  • change result format and optionally add a unit text as suffix for the result (which will change the format from integer to string)

The return value will contain the rounded amount of minutes, seconds or milliseconds (to feed a timer for example). If the input text / DOM element is undefined or empty, the result will be 0 (regardless of the defined minimum duration in seconds).