Rich-text Reply

Sitewide Header Test + Homepage Headline Test

bob25 02-05-15
Accepted Solution

Sitewide Header Test + Homepage Headline Test

I'm trying to run a test where I change a site's tagline in the header across all pages along with a block of H1 text on the homepage. 

 

When I set up a substring match to take the tagline change to all pages, it also changes the H1 text on all pages (ignoring the H1 class this is unique to the homepage).

 

Is there a way in variation code to only include the H1 edits on the homepage through a simple match? Or do I need to set these up as two seperate experiments?

Level 2

MartijnSch 02-05-15
 

Re: Sitewide Header Test + Homepage Headline Test

Are you sure the selector on the homepage is set up correctly then, because then it should only be able to change the look and feel on the homepage.
greg 02-05-15
 

Re: Sitewide Header Test + Homepage Headline Test

Your selector is probably too broad. If you can share it here we might be able to spot the issue.

Level 2
bob25 02-05-15
 

Re: Sitewide Header Test + Homepage Headline Test

[ Edited ]

Your response made me take another look and I think it was an issue where the selectors are determined by the DIV container, but editing the element in Optimizely was not picking up the right DIV.

 

The div is set as:

 

<div class="col-md-14 banner-content">

 

but it pulled

 

$(".col-md-14 > h1").replaceWith("<h1>CLIENT TEXT</h1>").

 

By changing it to 

 

$(".banner-content > h1").replaceWith("<h1>CLIENT TEXT</h1>"),

 

it has confined the change to just the homepage.

We had a similar problem making a change to a CSS3 style through the visual editor, so I think it's just a lesson to make sure Optimizely is speaking the language of the site (and vice-versa.)

Level 2