AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Optimize
2.5K members online now
2.5K members online now
Discover how to select who is eligible to be in your experiment, and when they’re served experiment variations.
Guide Me
star_border
Reply

Targeting using data layer variable but test not firing

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

The way my site set up means i cant target product pages easily so i have had a data layer added to my site ( https://www.visitbritainshop.com/world/manchester-city-football-club-stadium-tour/)

 

The data layer look like this 

<script>dataLayer = [{'pageName':'Manchester City Stadium Tour','pageType':'Product Details','productName':'manchester city football club stadium tour','parentProductId': '46e67412-28a4-43fe-b462-a2b60108fc9f','price': 17.50 }];</script>

 

I then pull out Page Type to a variable in GTM as below

image.png

 

I have tried setting up variable in optimize as below but both dont work can any one tell me why?

image.png

And I tired

image.png

 

 

1 Expert replyverified_user

Targeting using data layer variable but test not firing

Google Employee
# 2
Google Employee

What you need to do is:

 

Data Layer Variable Name: pageType

Name your variable: "Page Type"

(or any other name you like)

 

and then use this in experiment rules i.e.

"Page Type" equals Product Details

 

You need to define the dataLayer values above your Optimize or GTM installation.

I had a look at your site and I think that it all looks good.

Do you still have issues?