Download and test GTM4WP 2.0.0 beta2. Don’t wait for others to test it, they are waiting for you!

Skip to content
Facebook Twitter Github RSS
Google Tag Manager for WordPress
  • Home
  • FeaturesExpand
    • Basic features of GTM4WP

      You can use many post or page attribute in you Google Tag Manager setup even for custom post types and taxonomies.

      Basic data

      Page / post attributes

      Site search

      User data

      Multisite data

      3rd party data

      Browser attributes

      Device attributes

      Operating system attributes

      Weather conditions

  • SetupExpand
    • Setup advanced GTM4WP features

      Integrate your measurement with WooCommerce, setup Google Analytics 4, Google Ads remarketing or conversion tracking maximizing capabilities.

      WooCommerce related

      Google Analytics 4

      Google Ads – Dynamic Remarketing

      Google Ads – Conversion tracking

      Google Ads – Enhanced Conversions

      Other setup articles

      Cache Safe Data Layer

      Exclude WordPress admins

      Embedded media players

  • DevelopersExpand
    • Information for developers and WP managers

      There are several tools in GTM4WP to support your special needs and to adjust plugin behavior to your website or WooCommerce shop.

      Do you want to contribute with a bugfix or a new feature? Visit the GTM4WP’s GitHub page!

      For Developers

      Actions and filters

      WP themes + Proper ecommerce tracking

      For WP managers

      Setup GTM Environments

      Hard code GTM parameters

  • Blog
  • GDPR
Download
Google Tag Manager for WordPress
Home / Use special 3rd party data in Google Tag Manager / Operating system attributes in the data layer

Operating system attributes in the data layer

Google Tag Manager for WordPress can add the name and version of the operating system your visitor uses into the data layer. Turn on the OS data option in the Browser, OS & device data section of the plugin settings to make these variables available.

This page describes GTM4WP 2.0.0 and newer. Where the legacy 1.x versions of the plugin behaved differently, the older behavior is marked with a bold GTM4WP 1.x: lead-in.

The plugin identifies the operating system with User-Agent Client Hints, which the browser itself provides. Browsers that do not support Client Hints, currently Safari and Firefox, fall back to reading the user agent string, which gives less detail.

Three details are worth knowing before you build tags on these variables:

  • The values arrive in a gtm4wp.deviceData event shortly after the page has loaded, not in the initial data layer object. Tags that read these variables need a Custom Event trigger that listens for gtm4wp.deviceData.
  • A variable that the browser cannot determine is left out of the event instead of being set to an empty string. Check that the variable exists before you use it in a trigger condition.
  • The detection happens in the browser, so the values stay correct on pages that are served from a page cache or a CDN.

GTM4WP 1.x: the operating system was identified on the server with the bundled WhichBrowser library, using the headers that the browser sent with the request, and the values were part of the data layer object written into the page. The library is no longer bundled with the plugin.

Please make sure that you do not use this data for unethical purposes. Ask for consent from your visitor if you access or process the data in a way that falls under data protection regulations.

Note: you do not need this feature to collect browser, operating system and device data in Google Analytics, which measures all of that on its own. The feature is useful if you want to pass such data to other 3rd party systems, or to limit certain tags in your Google Tag Manager container so that they fire only on specific operating systems.

The same detection also provides browser attributes and device attributes, each with its own checkbox in the plugin settings. If you turn on more than one of the three options, all of the values are delivered in the same gtm4wp.deviceData event.

With the OS data option turned on, you can access the following data layer variables:

  • osName
  • osVersion

osName

The name of the operating system that your visitor uses to run the browser. Example values are: Windows, macOS, Android, Linux, etc. Where the user agent string is used instead of Client Hints, the plugin recognizes Windows, Android, iOS, macOS and Linux.

osVersion

The version of the operating system that your visitor uses to run the browser. Client Hints treats the operating system version as detailed information that the browser may withhold, so this variable is not always present even when osName is. Check that it exists before you use it in a trigger condition.

On Windows the reported number is not the marketing version of the operating system. Windows 11 reports a major version of 13 or higher, while Windows 10 reports a lower one, so a condition that compares this variable to 10 or 11 does not identify the Windows version.

GTM4WP 1.x: WhichBrowser parsed the version from the request headers on the server, so the variable was always present and it reported the marketing version. Windows 11 read as 11 and Android 13 read as 13. Review any trigger that compares osVersion to a fixed number.

© 2026 Google Tag Manager for WordPress - Privacy policy

  • WordPress.org plugin page
  • Plugin support
  • Plugin reviews
  • Home
  • Features
    • Basic features of GTM4WP

      You can use many post or page attribute in you Google Tag Manager setup even for custom post types and taxonomies.

      Basic data

      Page / post attributes

      Site search

      User data

      Multisite data

      3rd party data

      Browser attributes

      Device attributes

      Operating system attributes

      Weather conditions

  • Setup
    • Setup advanced GTM4WP features

      Integrate your measurement with WooCommerce, setup Google Analytics 4, Google Ads remarketing or conversion tracking maximizing capabilities.

      WooCommerce related

      Google Analytics 4

      Google Ads – Dynamic Remarketing

      Google Ads – Conversion tracking

      Google Ads – Enhanced Conversions

      Other setup articles

      Cache Safe Data Layer

      Exclude WordPress admins

      Embedded media players

  • Developers
    • Information for developers and WP managers

      There are several tools in GTM4WP to support your special needs and to adjust plugin behavior to your website or WooCommerce shop.

      Do you want to contribute with a bugfix or a new feature? Visit the GTM4WP’s GitHub page!

      For Developers

      Actions and filters

      WP themes + Proper ecommerce tracking

      For WP managers

      Setup GTM Environments

      Hard code GTM parameters

  • Blog
  • GDPR
Search