How To Set Device Type In Google Tag Manager

If you need to figure out and set device type in Google Tag Manager, but you have a responsive website, it can be difficult. Thankfully using Custom Javascript you can set device widths that are equal to your framework’s breakpoints.

To do this, you’ll first need to create a Custom Javascript Variable in Google Tag Manager. Name this “Device Type” and add this code:

Then adjust the minimum widths of each device based on the responsive breakpoints of your site. Here I have desktop minimum width at 1002px, tablet is 768 pixels and mobile minimum is 0px.

Click save and you’re ready to begin using this new variable in any Trigger.

Also checkout how to save a URL UTM Parameter in Google Tag Manager.

Leave a Reply