Guest User

Google Experiments Multi Variation Test jQuery switch

a guest
Oct 20th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function do_experiment_1(){
  2.  
  3.     /* Ask Google Analytics which variation to show the user. */
  4.     var chosenVariation = cxApi.chooseVariation();
  5.    
  6.     /* Define JavaScript for each page variation of this experiment. Using http://blog.crazyegg.com/2012/07/11/website-color-palettes/ */
  7.    
  8.     switch(chosenVariation) {
  9.  
  10.     case 1:
  11.             /*  Variation 1: Mea Cuppa */
  12.            
  13.             /*  Widget background & text colour */
  14.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #FFF056 !Important;background-color: #DFE2DB;color:#191919;");
  15.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #191919");
  16.             /*  Button: normal */
  17.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  18.                'background-color'   : '#FFF056',
  19.                'color'              : '#191919',
  20.             });
  21.             /*  Button: hover */
  22.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function(){
  23.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css("background-color","#191919");
  24.             });
  25.    
  26.         break;
  27.     case 2:
  28.             /* Variation 2:  Black & White */
  29.            
  30.             /* Widget background & text colour */
  31.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #000000 !Important;background-color: #F9F9F9;color:#000000;");
  32.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #000000");
  33.             /* Button: normal */
  34.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  35.                'background-color'   : '#000000',
  36.                'color'              : '#FFFFFF',
  37.             });
  38.             /* Button: hover */
  39.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  40.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  41.                    'background-color'   : '#424242',
  42.                    'color'              : '#FFFFFF',
  43.                 });
  44.             });
  45.    
  46.         break;
  47.     case 3:
  48.             /* Variation 3: NHS Blue + Darker button */
  49.            
  50.             /* Widget background & text colour */
  51.  
  52.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #1572B8 !Important;background-color: #eaf6ff;color:#000000;");
  53.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #1572B8");
  54.             /* Button: normal */
  55.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  56.                'background-color'   : '#1572B8',
  57.                'color'              : '#FFFFFF',
  58.             });
  59.             /* Button: hover */
  60.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  61.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  62.                    'background-color'   : '#0c4e7c',
  63.                    'color'              : '#FFFFFF',
  64.                 });
  65.             });
  66.    
  67.         break;
  68.     case 4:
  69.             /* Variation 4: John Lewis Green  */
  70.            
  71.             /* Widget background & text colour */
  72.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #163E00 !Important;background-color: #e0ffce;color:#000000;");
  73.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #163E00");
  74.             /* Button: normal */
  75.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  76.                'background-color'   : '#163E00',
  77.                'color'              : '#FFFFFF',
  78.             });
  79.             /* Button: hover */
  80.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  81.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  82.                    'background-color'   : '#010500', /* darker button on hover */
  83.                    'color'              : '#FFFFFF',
  84.                 });
  85.             });
  86.    
  87.         break;
  88.     case 5:
  89.             /* Variation 5: The Big Top - Orange */
  90.            
  91.             /* Widget background & text colour */
  92.  
  93.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #C63D0F !Important;background-color: #FDF3E7;color:#3B3738;");
  94.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #C63D0F");
  95.             /* Button: normal */
  96.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  97.                'background-color'   : '#C63D0F',
  98.                'color'              : '#FFFFFF',
  99.             });
  100.             /* Button: hover */
  101.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  102.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  103.                    'background-color'   : '#7E8F7C',
  104.                    'color'              : '#FFFFFF',
  105.                 });
  106.             });
  107.    
  108.         break;
  109.     case 6:
  110.             /* Variation 6:  Lemon Stand App - Yellow bg + Red Button */
  111.            
  112.             /* Widget background & text colour */
  113.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #6DBDD6 !Important;background-color: #FFE658;color:#404040;");
  114.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #6DBDD6");
  115.             /* Button: normal */
  116.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  117.                'background-color'   : '#B71427',
  118.                'color'              : '#FFFFFF',
  119.             });
  120.             /* Button: hover */
  121.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  122.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  123.                    'background-color'   : '#404040',
  124.                    'color'              : '#FFFFFF',
  125.                 });
  126.             });
  127.    
  128.         break;
  129.     case 7:
  130.             /* Variation 7: Tori’s Eye ( Greens) */
  131.            
  132.             /* Widget background & text colour */
  133.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #005A31 !Important;background-color: #F3FAB6;color:#000000;");
  134.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #005A31");
  135.             /* Button: normal */
  136.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  137.                'background-color'   : '#005A31',
  138.                'color'              : '#FFFFFF',
  139.             });
  140.             /* Button: hover */
  141.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  142.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  143.                    'background-color'   : '#A8CD1B',
  144.                    'color'              : '#FFFFFF',
  145.                 });
  146.             });
  147.    
  148.         break;
  149.     case 8:
  150.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #000000 !Important;background-color: #F9F9F9;color:#000000;");
  151.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #000000");
  152.             /* Button: normal */
  153.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  154.                'background-color'   : '#000000',
  155.                'color'              : '#FFFFFF',
  156.             });
  157.             /* Button: hover */
  158.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  159.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  160.                    'background-color'   : '#424242',
  161.                    'color'              : '#FFFFFF',
  162.                 });
  163.             });
  164.    
  165.         break;
  166.     case 9:
  167.             /* Variation 9: Cheese Survival Kit - Dark + Red */
  168.            
  169.             /* Widget background & text colour */
  170.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #DE1B1B !Important;background-color: #F6F6F6;color:#000000;");
  171.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #DE1B1B");
  172.             /* Button: normal */
  173.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  174.                'background-color'   : '#DE1B1B',
  175.                'color'              : '#FFFFFF',
  176.             });
  177.             /* Button: hover */
  178.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  179.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  180.                    'background-color'   : '#2B2B2B',
  181.                    'color'              : '#FFFFFF',
  182.                 });
  183.             });
  184.    
  185.         break;
  186.     case 10:
  187.             /* Variation 10: Nordic Ruby - Purple & Blue */
  188.            
  189.             /* Widget background & text colour */
  190.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #7D1935 !Important;background-color: #F5F3EE;color:#000000;");
  191.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #7D1935");
  192.             /* Button: normal */
  193.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  194.                'background-color'   : '#4A96AD',
  195.                'color'              : '#FFFFFF',
  196.             });
  197.             /* Button: hover */
  198.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  199.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  200.                    'background-color'   : '#7D1935',
  201.                    'color'              : '#FFFFFF',
  202.                 });
  203.             });
  204.    
  205.         break;
  206.     case 11:
  207.             /* Variation 11: Odopod - Pink & Off Black */
  208.            
  209.             /* Widget background & text colour */
  210.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #DF3D82 !Important;background-color: #FFFFFF;color:#191919;");
  211.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #DF3D82");
  212.             /* Button: normal */
  213.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  214.                'background-color'   : '#DF3D82',
  215.                'color'              : '#FFFFFF',
  216.             });
  217.             /* Button: hover */
  218.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  219.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  220.                    'background-color'   : '#191919',
  221.                    'color'              : '#FFFFFF',
  222.                 });
  223.             });
  224.    
  225.         break;
  226.     case 12:
  227.             /* Variation 12: eBay Blue */
  228.            
  229.             /* Widget background & text colour */
  230.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #00539F !Important;background-color: #F9F9F9;color:#555555;");
  231.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #00539F");
  232.             /* Button: normal */
  233.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  234.                'background-color'   : '#00509d',
  235.                'color'              : '#FFFFFF',
  236.             });
  237.             /* Button: hover */
  238.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  239.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  240.                    'background-color'   : '#00539F',
  241.                    'color'              : '#FFFFFF',
  242.                 });
  243.             });
  244.    
  245.         break;
  246.     case 13:
  247.             /* Variation 13: Amazon - White/Grey/Yellow */
  248.            
  249.             /* Widget background & text colour */
  250.             jQuery(".wdpu-middle .WL_RegistrationWidget").attr("style", "border : 4px solid #F0C250 !Important;background-color: #FFFFFF;color:#333333;");
  251.             jQuery(".wdpu-middle .WL_RegistrationWidget h2").attr("style", "color: #F0C250");
  252.             /* Button: normal */
  253.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  254.                'background-color'   : '#F0C250',
  255.                'color'              : '#333333',
  256.             });
  257.             /* Button: hover */
  258.             jQuery(".wdpu-middle .WL_RegistrationWidget #submit").hover(function() {
  259.                 jQuery(".wdpu-middle .WL_RegistrationWidget #submit").css({
  260.                    'background-color'   : '#d6ab48',
  261.                    'color'              : '#333333',
  262.                 });
  263.             });
  264.         break;
  265.     } // /switch
  266.  
  267. } // /do_experiment_1
Add Comment
Please, Sign In to add comment