There may be times when you wish to load the Evidence Pixel on desktop only. This guide will show you how to do that using Google Tag Manager.
Google Tag Manager by default doesn't allow you to use Device Type as a variable. We will be using a workaround by creating a custom JavaScript variable the runs a script depending on the resolution of the screen viewing the page.
NOTE: This article does not cover setting up Google Tag Manager or adding the Evidence pixel to your account. For instructions on how to add your pixel to your GTM account, read the article Install Evidence Pixel using Google Tag Manager.
Step 1: Create a New Variable
Log in to Google Tag Manager and click Variables from the menu on the right.
Under User-Defined Variables, click the blue New button.
Hover over the Variable Configuration box and click the pencil icon that appears in the top right.
Select Custom JavaScript from the menu.
Paste the following JavaScript code into the Custom JavaScript box.
function()
{
/// the minimum width for each device we're able to detect, from big to small
var deviceMinWidths = {
'desktop': 769,
'tablet': 321,
'mobile': 0
}
/// find the device type
for(var device in deviceMinWidths)
{
if(window.screen.width >= deviceMinWidths[device])
{
return device;
}
}
}
Name the Variable Screen Resolution and click the blue save button in the top right.
Step 2: Create a New Trigger
Click Triggers from the menu on the left.
Then Click the blue New button on the right.
After that click the Pencil icon when you hover over Trigger Configuration. Then select Page View.
Click the Some Page Views radio button, then configure the condition as Screen Resolution >> contains >> desktop.
Name your Trigger Desktop Only, and click Save on the right.
Step 3: Add the Trigger to your Evidence Tag
Now click Tags from the menu on the left.
Click the Name of the tag that you are using to fire the Evidence Script.
Under Triggering, click the pencil icon in the top right.
Click the Plus button. Then click the Desktop Only trigger we created earlier.
After that, click minus icon on the All Pages trigger. Then click Save.
Step 4: Submit and Publish
Click Submit in the top right of the screen.
Give your version a Name and Description. Then click Publish in the top right.
Relevant Articles
- A/B Test Social Proof Notifications Using Google Optimize
- Excluding Evidence on Specific Google Tag Manager Pages
- How to Add Evidence to Google Tag Manager
Create Your Free Evidence Account
Increasing your website's conversions isn't always black and white. With so many ways, it can be confusing where to start. Evidence makes this easy. Within a few minutes, you can have real-time social proof added to your site and boosting conversions from 10-15%.
Social proof is the best way to build trust and increase buyer urgency. With a free trial to Evidence, you can add high-converting notifications to your website. Your free trial includes:
- Unlimited Domains
- Unlimited Notifications
- Conversion Notifications
- Hot Streak Notifications
- Visitor Count Notifications
- Offer Notifications
- Announcement Notifications
- Boomerang Tabs
- Powerful Design Editor
- Best-in Class Display Options
There is no long-term obligation. If you don't see results, simply cancel. Visit Evidence.io and create your trial account today.
If you ever need help sending data to Evidence, check out Parsey.com.