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.2K members online now
2.2K 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

Dynamic or flexible text change testing

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all, 

 

I am looking to be able to set up a test in Optimize where the text changes based on the content on the page - for example, I want to test three headers - 

1. Jump 

2. More Information

3. More Information About [CONTENT ON PAGE]

With variant 3 being dynamic so that I can run across multiple pages, all of which have different content titles

 

Is this possible? If so, what is the best way to do so? 

 

Thank you!

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Sarah K
January

Dynamic or flexible text change testing

Google Employee
# 2
Google Employee

The only way I can think is using the "Run Javascript" option from the editor palette (needs a bit of coding).

 

Do the following:

 - Click on the element that contains the [CONTENT ON PAGE].

 - Open the "advanced selection" dialog on the left of the hierarchy bar and note its selector.

   This may look to something like: .content-selector

 - Click on the header that you want to change and do the same (i.e. CSS selector might look like ".header > div:nth-child(0)")

 

If the [CONTENT ON PAGE] is located above the header, then click on the header, use the "Run Javascript" option and type code like:

element.innerText = 'More Information About ' + document.querySelector('.content-selector').innerText;

 

If its the other way around click on the [CONTENT ON PAGE] the "Run Javascript" option and type code like:

document.querySelector('.header').innerText =  'More Information About ' + element.innerText;

 

Hope that this works.

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Sarah K
January

Dynamic or flexible text change testing

Google Employee
# 2
Google Employee

The only way I can think is using the "Run Javascript" option from the editor palette (needs a bit of coding).

 

Do the following:

 - Click on the element that contains the [CONTENT ON PAGE].

 - Open the "advanced selection" dialog on the left of the hierarchy bar and note its selector.

   This may look to something like: .content-selector

 - Click on the header that you want to change and do the same (i.e. CSS selector might look like ".header > div:nth-child(0)")

 

If the [CONTENT ON PAGE] is located above the header, then click on the header, use the "Run Javascript" option and type code like:

element.innerText = 'More Information About ' + document.querySelector('.content-selector').innerText;

 

If its the other way around click on the [CONTENT ON PAGE] the "Run Javascript" option and type code like:

document.querySelector('.header').innerText =  'More Information About ' + element.innerText;

 

Hope that this works.

Dynamic or flexible text change testing

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you - this is perfect!

 

 

The only downside to Optimize -- that it requires some coding from time to time/not entirely WYSIWYG