Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I want to set up a Google Analytic's Experiment to test variations of product page. Parts of the URL changes depending on what product you are viewing - here are some examples...

  • domain.com/products/shirt/100
  • domain.com/products/pants/200
  • domain.com/products/hat/300


I want to experiment on everything that comes after /products/.

How can I set this up as an experiment? Do I just input domain.com/products/? Or do I add some fancy regular expression magic?

... Is this at all possible, or do Experiments only apply to static pages? If that's the case; what alternatives are there out there?

share|improve this question
    
Could you please add more details on your question? –  Servant Apr 13 '13 at 9:35
add comment

migrated from stackoverflow.com Apr 29 '13 at 18:46

This question came from our site for professional and enthusiast programmers.

4 Answers

What do you mean, you want to experiment on everything that comes after the folder /products/ of your website? If you mean, is to make all of the pages that comes after that folder, become variations, then I'm sorry because the variations are only limited to 9 pages. Some other articles like Split Testing With Google Analytics Experiments | Webdesigntuts+, said that the variations are limited to five, but when I test it, I could add up to nine variations. So, the best thing that you can do is to add the most important and you think the best pages to become variations, such:

- Original Page : domain.com/products
- Variation 1   : /shirt/100
- Variation 2   : /pants/200
- Variation 3   : /hat/300
- Variation 4   : /a/400
- Variation 5   : /b/500
- Variation 6   : /c/600
- Variation 7   : /d/700
- Variation 8   : /e/800
- Variation 9   : /f/900

And if it's not enough for you, then you can create another experiment after a winner have been arrived on this experiment, after replacing the file of your original page with the file of the winner variation if ever the original have defeated. And then create a new experiment with different variation pages, only if you still want to improved the original page.

For example the original page has defeated by the variation 1 domain.com/shirt/100 then you should better replaced the file of domain.com/products into the file of domain.com/shirt/100 then start a new experiment again but in this time, with different competitors like:

- Original Page : domain.com/products
- Variation 1   : /g/1000
- Variation 2   : /h/1100
- Variation 3   : /i/1200
- Variation 4   : /j/1300
- Variation 5   : /k/1400
- Variation 6   : /l/1500
- Variation 7   : /m/1600

However, you can still apply the loser variations of the previous experiment to become new variations on your new experiment, to become competitors of your improved original page, such:

  • Variation 8 : /pants/200
  • Variation 9 : /hat/300

But make sure that their sources are much different from theirs sources before they've been defeated, to test the improvements of their files if one of them can become the most successful on the new experiment.

share|improve this answer
    
Sorry, but you are wrong. You can run the experiment on as many pages as you want. You are limited in the number of variations, not the number of pages. –  Old Pro Apr 21 '13 at 17:39
    
@OldPro Why you don't just edit the mistake.. –  Servant Apr 21 '13 at 17:45
    
I didn't edit the answer because in my opinion the whole answer is bad and it would be vandalism to edit the answer to that extent. See my answer for more details. –  Old Pro Apr 21 '13 at 17:49
    
@OldPro Wait, what's wrong with the answer? Are you sure that you can run the experiment on as many variation pages as you want? It's better to use the Google Analytics' Experiments properly. –  Servant Apr 21 '13 at 18:02
    
Yes, I'm sure, it's described in the official documentation. See How Relative URLs Work with Multiple Original Pages, particularly where it says "Because the original page may in fact be a set of pages, and you would therefore place the experiment code on multiple pages..." –  Old Pro Apr 28 '13 at 18:40
show 1 more comment

I think you really should have each of those pages as a separate experiment, you can then append the query parameters as you need. But if you want to test shirts vs hats page, then I would look at using /products but setting the category "shirts" or "hats" as a parameters - then you can test the page as you wish. ie /products?cat=shirts

The docs describe this method nicely It's all nicely described in the docs (#3): http://support.google.com/analytics/answer/2618450?hl=en

share|improve this answer
add comment

You can make it in Java:

Here is a class to read pages from th internet:

    import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Hydroid     */
public class LoadURL {
    public LoadURL(String urlRequest) throws IOException{
    SocketChannel sock = null;
    try{
        URL url = new URL(urlRequest);
        String host = url.getHost();
        String page = url.getPath();
        InetSocketAddress adress = new InetSocketAddress(host, 80);
        Charset iso = new Charset.forName("ISO-8859-1");
        CharsetDecoder decoder = iso.newDecoder();
        CharsetEncoder encoder = iso.newEncoder();

        ByteBuffer byteData = ByteBuffer.allocate(16384);
        CharBuffer charData = CharBuffer.allocate(16384);

        sock = SocketChannel.open();
        sock.configureBlocking(false);
        sock.connect(adress);

        Selector listen = Selector.open();
        sock.register(listen, SelectionKey.OP_CONNECT + SelectionKey.OP_READ);

        while(listen.select(500) > 0){
        Set keys = listen.selectedKeys();
        Iterator i = keys.iterator();
        while(i.hasNext()){
            SelectionKey key = (SelectionKey) i.next();
            i.remove();
            SocketChannel keySock = (SocketChannel) key.channel();
            if(key.isConnectable()){
            if(keySock.isConnectionPending()){
                keySock.finishConnect();
            }
            CharBuffer httpReq = CharBuffer.wrap("GET"+ page + "\n\r\n\r");
            ByteBuffer request = encoder.encode(httpReq);
            keySock.write(request);
            } else if (key.isReadable()){
            keySock.read(byteData);
            byteData.flip();
            charData = decoder.decode(byteData);
            charData.position(0);
            System.out.print(charData);

            byteData.clear();
            charData.clear();
            }
        }

        }

    } catch (MalformedURLException e) {
        System.out.print(e.toString());
    }

    }
    public static void main (String args){
    try {
        LoadURL app = new LoadURL("yourpage");
    } catch (IOException ex) {
        Logger.getLogger(LoadURL.class.getName()).log(Level.SEVERE, null, ex);
    }
    }
}

Then you can load URLs from an ArrayList.

share|improve this answer
    
sorry for the bad formatting –  Hydroid Apr 18 '13 at 17:20
add comment

This use case is partly explained in the Google Analytics Help discussing using relative URLs, particularly the section labeled "How Relative URLs Work with Multiple Original Pages". In short, you define the experimental variations as using a parameter in your URL to choose the variants so you can apply the variations to a whole group of URLs. So you set up your server to show variant A at domain.com/products/shirt/100?var=a and variant B at domain.com/products/shirt/100?var=b and Google will assign visitors one variant or the other and track the results.

If you want to run the experiment across hundreds of product pages it's no problem, although it's not well explained. Any page that has the experiment code is part of the experiment. So you add the experiment code to your product template and specify a relative URL and that parameter will be added to every page that contains the experiment code, which is to say all your product pages. Then you just specify one specific product page as the "original" URL so Google can validate that it's all set up correctly and you're good to go.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.