Internet Business Blog
« Previous | Home | Next »

 

How to Switch CSS Files using Google Web Site Optimizer

Share/Bookmark

May 13, 2009

How to Switch CSS Files using Google Web Site Optimizer

How to Switch CSS Files using Google Web Site Optimizer

I've used a couple of different multivariate testing tools. I don't like any of them. Google Web Site Optimizer is my favorite so far, but there are some serious drawbacks with it too.

A split and multivariate testing tool allows you to run tests on a web page and optimize that page's components to achieve your goals. Those goals may be to sell a product, get an email address, or some other action.

A split test simply tests two version of a page. You make two pages, maybe varying one thing such as the headline text, body copy, or photos. The testing software randomly servers one page to some visitors and the other page to others visitors and tracks orders, signups, etc. from each page so that you can determine which page works or converts better.

A multivariate testing tool switches out various parts of a web page with different versions of that component. For example you may setup the headline as "variable" to be tested, a photo as a variable to be tested, the background color, the size of the order button, etc. For each variable create a few variations. In other words you may have 5 headlines, 3 photos, 4 background colors, and 3 buttons sizes you want to test. The software randomly creates a version of the page by choosing one variation of each variable and tracks how it converts. Some software automatically serves the combinations that convert better more often.

Google Web Site Optimizer does both split and multivariate testing. But because it runs from Google's servers, it uses client-side JavaScript to perform the switching and tracking. If it installed on your server, it could use server-side scripting and have more powerful capabilities. Client-side simply means that the code for making Google Web Site Optimizer display the various versions of the variables you're testing runs on the PC of the person looking at your web page. Server-side means that code runs on the web server running your web site before that server sends the page across the internet to the person looking at your web page.

The way Google alters the displayed web page is by using JavaScript document write commands. You tag the sections of the page you want to test with special tags and give each a unique name so that the Google JavaScript code can find them. The document.write command alters a part of the page after the page loads, changing the text or photo from the original to the version being tested.

What are some of the problems that occur because Google uses client-side JavaScript?

Let's say you want to test a photo vs. a flash video. Depending on what you used to create the flash video and its embedded player, it may use JavaScript to test if flash is installed on the client PC and then use document writes to display the flash player and the video, or a message telling the user that they need to install flash on their system. Embedding a document.write inside another document.write (called nesting) seems to cause some issues. I ran into this problem setting up the page for my wife's children DVD, www.MissKimDance.com and it finally hit me that the problem was the nested document writes. I ended up bypassing the JavaScript test for determining if flash was installed and simply put the code for the player and video in the Google Optimizer variable. Under that I put a link to the installation for flash from Adobe's web site and a short statement that says you need flash to view the video. Problem solved and it works great.

But what about switching out CSS include files? CSS stands for Cascading Style Sheets and controls how a web page looks. If you don't know what CSS is and how it works, you can get my free courses on web site creating and web site scripting - they're listed in the right column in the "My Products" section. Your CSS should generally be in an included file, not directly in your web page code. Why there are two reasons. If the CSS is in a separate file, you can reference it from multiple web pages and save yourself a tremendous amount of editing if you want or need to change how your site looks. It's also one of the things I talk about in my Search Engine Optimization course SEO Secrets Revealed and that's all I'm going to say about that - you can get the course to find out why!

What makes switching the CSS file confusing is that the CSS file is loaded in the section of a web page and the JavaScript for Google Web Site Optimizer comes below that. So how can you use Optimizer to change CSS files?

And why would I want to? I typically use a set of background graphic files to form a web page that looks kind of like a sheet of paper. I want to test various background colors. The background image files and the background color are defined in the CSS file. I may also want to test various colors for the headline font, various sizes of the headline font, etc. and those are also defined in the CSS file. A good example of this is the SEO Course I mentioned above, I'm testing a few different background colors. Try it from a few different computers and you should see some variations in the background, header graphics, and headline.

To make the multivariate testing work better, you could even create multiple CSS files for each purpose: one for the background images and color and another for the headline size and color. Then you could make several variations of each, loading the appropriate background images and setting the appropriate background color, setting the font size, etc.

But how do you switch them with Google Optimizer?
First, you must reference the included CSS file with a link command and give it an id (there is more than one way to include the CSS file). Once you use the link command, you can then use JavaScript to update the link to use a different CSS file and the page will reflect this new CSS file.

Second, you make an empty Web Site Optimizer tag and name it something like CSSCode and put it directly after the JavaScript code that you stuck in your web page to make Web Site Optimizer work.

Third, in the setup pages for your Google Optimizer test, you create a few variations for this CSS variable section and put in the JavaScript code to update the CSS file... simple as that. Works like a charm.



This is the code in the section of your web page to reference or include the CSS file...



This is the "empty" Google Web Site Optimizer tag where we'll put JavaScript in the variations to load other CSS files.



This is an example of one of the variations you would create for the CSS-switch variable in Google Web Site Optimizer.


This causes the page to use the myCSS-2.css file which you could use to have a different page background or whatever. I simply copied my main CSS file to create 3 or 4 versions that changed the background images and background color.

Hopefully this will help some of you get better results.

Until next time,
Fred

About the Author

Fred Black is an experienced online business operator, programmer, web site developer, father, husband, musician, and songwriter. Visit his Internet Business Blog at: http://www.pqInternet.com.


You may reprint or distribute this article as long as you leave the content and the About the Author resource box at the end intact.


Get Free Updates! Enter your name and e-mail address to receive a short notice each time I make a new post.

First Name:

Last Name:

E-Mail Address:

E-Mail again:

NOTE: You will receive a confirmation email. You must click the link in the email to activate your free updates. Please check your spam folder(s) if you don't receive the email.


Share/Bookmark

Tip Jar: Leave a Donation

Comments: 10,   TrackBacks: 0.

Posted by Fred on May 13, 2009 | Printer-Friendly

TrackBack: http://www.pqInternet.com/Blog/mt-tb.cgi/196


Assigned Categories: Internet Marketing | Web Site Design, HTML, CSS


Related Entries:

 

 
Comments and TrackBacks 
  Comments:
  1. From: Wedding Cake Toppers

    thank u for giving such nice information.
    now it will be easy for me to switch css files.
    Thanks a lot!

    Posted by Wedding Cake Toppers on June 14, 2009 5:47 AM

  2. From: Knockout Roses

    Great info, worked like a charm...

    Posted by Knockout Roses on June 24, 2009 3:48 PM

  3. From: Affiliate marketing blog

    I didn't knew you can do something like this. Changing CSS files opens a whole new frontier for my blog. Thank you for posting this great idea.

    Posted by Affiliate marketing blog on July 7, 2009 7:42 AM

  4. From: sabby@Webinar Hosting

    this is perfect. i am going to use it. i will check this first. thanks for sharing your post.

    Posted by sabby@Webinar Hosting on July 17, 2009 8:49 AM

  5. From: Audio Bible

    I wonder if this could be used in Google Website optimizer, in this way.

    I have a header include file that is on every page of my website. Example header. asp, this file is in every page on my website.

    What I am want to do is test to see if I add an image to the header, will the image improve conversion.

    So basically I want to include a small piece of code inside the header.asp file.

    Plus I need to include the bottom tracking code in the footer.asp file as well to help track conversion to my shopping cart page.

    Can this code you mention above do this? If so, what and how would I need to change things?

    Posted by Audio Bible on August 20, 2009 4:24 PM

  6. From Fred...

    For Comment #5:
    You don't need this code to do what you want to do. Just put the normal website optimizer code inside the included asp file for your header and it will work.

    Fred

    Posted by Fred Black on August 21, 2009 12:10 AM

  7. From: jim@Boys Truck T-shirts

    this is wonderful to read . thanks for sharing. its useful and helpful as well.

    Posted by jim@Boys Truck T-shirts on August 28, 2009 8:27 AM

  8. From: Jim Painters

    I am just starting to get into testing like and this was very helpful. I had to re-read it about 4 times, but thanks for the great info.

    Posted by Jim Painters on October 26, 2009 12:42 PM

  9. From: Albert

    Can you help me? When I am updating my css file and inserting "" I am getting an error, as there is no file myCSS-1.css.

    Posted by Albert on April 19, 2010 7:07 AM

  10. From: Utility trailers

    CSS makes your website more accessible. The number of users browsing the web through hand held devices are continuously growing tremendously. It is estimated that by 2008, one third of the world's population will be using hand held devices for accessing Internet. It is always important that your site is accessible to them also. You can make an additional CSS document particularly for handheld devices like cell phones, which will be called up in place of the regular CSS document; which is not achievable with a tabular layout. CSS benefits accessibility chiefly by separating document structure from presentation. By separating style from markup, webmasters can simplify and clean up the HTML in their documents, making the documents more accessible.

    Ronnie Gibbs

    Posted by Utility trailers on April 28, 2010 8:08 AM

 


Post A Comment




Remember personal info?




Comment Policy <--- Read the comment policy (Updated 1/13/2010).

About  Contact  Free Products Fred W. Black

Blog Feeds, EMail, etc.:

Subscribe by EMail

RSS 2.0 Feed for www.pqInternet.com.
Add to Google Toolbar

Free Updates via EMail

Receive Free Updates.

Free Products and Software.

Search

 

Link to Me!

How to Link to this Blog.

Products

Products I Use & Recommend

www.3WayLinks.Net

www.1WayLinks.Net

Free Traffic System

Wordtracker Keyword Research Tool

www.aweber.com Opt-In List Management.

1&1 Hosting

Categories

All

ClickBank

Copywriting

Free Videos

Funny

Internet Business

Internet Marketing

Life

Search Engines: SEO

Social Media

Technology

Traffic

Truth and Freedom

Web Site Design, HTML, CSS

Recent Entries

Facebook Fan Pages and Static FBML Part 3: iFrames!

Facebook Fan Pages and Static FBML Part 2

Facebook Fan Pages and Static FBML - Part 1

Texting Social Media Updates - Useful vs. Useless

Success or Failure in an Internet Business Depends on Who's Looking Back at You in the Mirror...

Bullets from God - The Greatest Copywriter of All Time?

Success is not Sticky - You Have to Hold the BALL!

Birthday Salute!

New Layout

What's the Value of a Link to SEO (Search Engine Optimization)?

Internet Business Ethics 101

Exploding Your Copy (and life) From Sissy to SEISMIC.

Long Tail Keywords

I'm a Slasher!

Start Your Own Home Internet Business with these 7 Easy Steps...

All Entries

Recently Commented On

Mozilla Thunderbird Email Client - Part 2: Corrupted Inbox

Facebook Fan Pages and Static FBML - Part 1

Long Tail Keywords

Bullets from God - The Greatest Copywriter of All Time?

Success is not Sticky - You Have to Hold the BALL!

Success or Failure in an Internet Business Depends on Who's Looking Back at You in the Mirror...

Replacing a ClickBank Vendor's Sales Page with Your Own.

Facebook Fan Pages and Static FBML Part 2

Archives

All

Blog Roll

Clayton Makepeace

Terry Dean

Ryan Healy

ProBlogger

Internet Business Resources Blog

Michel Fortin

G. Brent Riggs

Jonathan Leger

Mark J Ryan

Dr. Joe Vitale

Search Engine Journal

Friday Traffic Report

Links

Cell Phones for Soldiers

Front Street Playschool

Clebe McClary

the IconFactory

Fred Black Music

Daryl Laws Sports Performance Blog

Williams High School Booster Club

Jacob Ingle

Light Peak

EasyIRS.com

Web Hosting

My Recommended Web Hosting Service: 1&1 Hosting

Mugs, Mousepads, etc.

About this Blog...

By:Fred W. Black

Contact Information

Powered by:Movable Type 3.34.

Copyright 2006 -2010, PhaseQuest.Com.
All rights reserved.

Subscribe by EMail RSS 2.0 Feed for www.pqInternet.com.

Add to Google Toolbar
My Facebook Fan Page
Twitter
Add www.pqInternet.com, to Google. Add www.pqInternet.com, to My Yahoo! Add www.pqInternet.com, to My MSN. Subscribe to www.pqInternet.com, with Bloglines Add www.pqInternet.com, to Your Technorati Favorites! Add www.pqInternet.com, to Windows Live

rs

Some photos are by: Lee Hinshaw Photography

© Copyright 2006 - 2010 PhaseQuest, all rights reserved.

 

Get Free Updates!

Insert your name and e-mail address to receive a short notice each time I make a new post.

First Name:

Last Name:

E-Mail Address:

E-Mail again:

NOTE: You will receive a confirmation email. You must click the link in the email to activate your free updates. Please check your spam folder(s) if you don't receive the email.

*I value your privacy and will never sell, rent, giveaway, or abuse your information.