Capturing Headings as Variables in GTM - Processes

Scope of this page

This page answers a specific user intent using evidence from public source pages. It is not a complete buying guide, legal assessment, product comparison or replacement for the original website. Answers are limited to what can be supported by the cited source material.

Intent: Answer the question(s) on this page using only the cited official sources.

Topic: Headings As Variables Gtm

Last updated:

Primary source: https://internetwarriors.de/en/blog/headings-as-variables-in-gtm

Quick Info

Custom JavaScript variables use the getElementsByTagName() method to extract the contents of HTML elements.

Purpose and usage

This page provides short, extractable answers for the topic above.

Key points

  • How does element numbering work for headings?: Element numbering for getElementsByTagName() starts at zero, meaning [0] retrieves the first instance of a heading.

Terms and entities

Canonical definitions live on the Facts pages. This page only references them.

What method is used to extract headings in GTM?

Custom JavaScript variables use the getElementsByTagName() method to extract the contents of HTML elements.

How does element numbering work for headings?

Element numbering for getElementsByTagName() starts at zero, meaning [0] retrieves the first instance of a heading.

Sources

  1. https://internetwarriors.de/en/blog/headings-as-variables-in-gtm

Machine metadata