Rich-text Reply

Is it possible to change the button text across all pages?

russtanner6 05-16-16
Accepted Solution

Is it possible to change the button text across all pages?

My company just launched a new website: www.fairmontschools.com. There is a button at the top of the page that says "Get Started" (although if you visit the URL you might see "Request Information" because I'm running a test). We're wanting to test whether "Get Started" or "Request Information" has more of an impact on the number of inquiries we receive. The Optimizely goal URL is the thank you page. 

 

Currently, I just have the test running on the home page. Although the "Get Started" button shows up on every page of the website. Ideally, I would like every instance of "Get Started" to be part of the experiement. But I'm not sure if that's possible (that way no matter where someone is on the website they will be part of the experiment). And if it is, how I would do it. 

 

Hopefully that makes sense. Thanks for your help!

JasonDahlin 05-17-16
 

Re: Is it possible to change the button text across all pages?

@russtanner6 - Your experiment's variation code is set up perfectly for what you want to accomplish.  Just change your URL targeting from:

 

"http://www.fairmontschools.com" Simple Match

to

"fairmontschools.com" Substring Match

 

and the experiment will then run on all pages of your website

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
JasonDahlin 05-17-16
 

Re: Is it possible to change the button text across all pages?

@russtanner6 - the change mentioned above will change every instance of that specific "Get Started" button.  If you have other places on the site that you also want to change, you'll need to identify them and modify the code in your variation to also modify those locations.

For example, in the "Locations" section on the homepage, there is another "Get Started" button.  To change that one you may want to do it like this:

$('div[data-dot-nav-label="Locations"] a[href="/get-started"]').html("Request Information")

If you wanted a single line of code that could read the entire page and replace any links from "Get Started" to "Request Information" you can try this... but it might be kind of slow:

$.each($('a'), function(){
  if ($(this).html() == "Get Started") {
    $(this).html("Request Information")
  }
})

 

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
russtanner6 05-17-16
 

Re: Is it possible to change the button text across all pages?

Great point. I didn't think about changing the other instances. How/where do I implement the code you sent me? Do I do it on this window somewhere (screenshot)? https://www.evernote.com/l/ABg7Zo9UAl5Fj4Ru1moC5so9sUCDnXCLcKQ

 

There are quite a few buttons that say "Get Started" throughout the site. Thanks a lot for your help.

JasonDahlin 05-17-16
 

Re: Is it possible to change the button text across all pages?

Hi @russtanner6,

 

In the screen shot, you have the URL Targeting window open.  Close that.

At the bottom of the page you will see a blue box labeled "edit code".

Click the [edit code] button and a window appears where you can edit what your experiment does.

Place this code in that window, apply the changes, then save the experiment.

 

$.each($('a'), function(){
  if ($(this).html() == "Get Started") {
    $(this).html("Request Information")
  }
})
--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
russtanner6 05-17-16
 

Re: Is it possible to change the button text across all pages?

Awesome! Thank you. I didn't know you could do that.
russtanner6 05-17-16
 

Re: Is it possible to change the button text across all pages?

Can multiple experiments run simultaneously?
russtanner6 05-17-16
 

Re: Is it possible to change the button text across all pages?

Sorry. Last question. I just noticed two red circles next to the code (screenshot: https://www.evernote.com/l/ABh1e5UVvxlKAIIwckgqFh2lUDihQBOGqM8). It says missing semicolon. Do I need to add a semi colon? It looks like it's working, even without the semicolons.
JasonDahlin 05-17-16
 

Re: Is it possible to change the button text across all pages?

Hi @russtanner6,

Yes - you can have multiple experiments running on the same page.

Both experiments will run on the page in a semi-random order.  So be sure there are not conflicts between them.

 

And, yes, you should probably add the semi-colons.  I've used some libraries where the method they use to compact the code causes code to break when semi-colons are missing at the end of lines.  Optimizely doesn't currently have an issue with it... those are more like "cautions" than "wanrings", but since they are calling it out for you to fix, it's easier to make the change and then if the experiment isn't workign for some reason, that's one less adjustment to test.

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
russtanner6 05-17-16
 

Re: Is it possible to change the button text across all pages?

Thanks. Do I just add a semicolon to the end of each line with the red x?
JasonDahlin 05-17-16
 

Re: Is it possible to change the button text across all pages?

Yes, like this:

$.each($('a'), function(){
  if ($(this).html() == "Get Started") {
    $(this).html("Request Information");
  }
});
--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero
Tripti 04-04-17
 

Re: Is it possible to change the button text across all pages?

[ Edited ]

Hi there, 

I have a similar test running - for text variations on button across the site (3 different pages). How to I track clicks on these buttons across the pages for each text variation?

Level 1
JasonDahlin 04-06-17
 

Re: Is it possible to change the button text across all pages?

You track clicks to the buttons as a single goal.

You can tell what the text was when they clicked on the button by looking at the "results" dashboard for the experiment to see how each variation performed.

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
Experimentation Hero