A/B testing using Google optimize

Avatar img
Francisco Limaico
Software Developer
agosto 03, 2020
Lectura de 2 minutos
A/B testing using Google optimize

Do you think that your website could have a better conversion rate or more visits if you make some changes? Did your developer or marketing team suggest you to modify some things, but you are not totally sure or convinced that it is the best thing to do?

Here we will show you how to perform tests on two or more versions of a website using a very useful tool by Google, called Optimize. Thus, you will be able to decide what works best in your site, based on actual data, instead of making assumptions.

First, What is A/B Testing?

In the first place, you must know that, an A/B test is a random experiment in which two or more variants of the same website (A and B) are used. Variant A is the original, and variant B (or C, D, F, or as many variants as needed) contains at least one modified element in the page. The idea is to check which of all versions is the most efficient or has a better performance, depending on your objectives.

The development of these tests can be confusing at the beginning, so it is advisable to start doing small experiments, such as changing the color of a button or removing an unnecessary field from a form. When you have got used to creating variants and experiments, you may expand the scope of your tests.

Performing tests with your website can help you to reduce bounce rates (people who abandon your page), improve your content and increase your conversion rates, among other things. However, this is not always the most advisable option.

You should not use A/B tests when:

  • You have few visits, because it would be more desirable to focus your efforts in increasing your traffic before performing any tests.

  • Your page has programming problems or something is not working properly. Focus on solving this first.

  • The cost of performing these experiments is greater than the profit they can provide you.

Second, What is Google Optimize?

It is a Google platform that allows users to perform different A/B testing campaigns. The most interesting thing about Google Optimize is that it takes A/B Testing to the next level, allowing you to show two or more variants of a website to the users (up to 5, with the new update of the platform).

Another interesting functionality are the redirect tests(or redirection tests). These allow you to perform tests in independent websites by sending a percentage of your traffic to one website version and a percentage to another.

Why Use Google Optimize?

Apart from multivariate or redirection tests, some of their numerous advantages, we can highlight the following:

  • Connection and integration with Google Analytics 360 suite.

  • Potential for deeper analyses directly from Google Analytics interface.

  • User-friendly visual editor for anyone with no coding background, for the creation of simple experiments.

Now, you know what A/B testing is and why applying it in Google Optimize is a great alternative; let's see what are steps to follow for implementing it. Then, we will create a small project using Angular in which we will change the style of a button. We will make it more noticeable, and we will check the number of times that users click on it.

State a Hypothesis

Before creating an experiment for the first time, it is of great help identifying the problem you have to solve, and then, stating a hypothesis about what you might change to improve it. Once your hypothesis is ready, evaluate under several parameters, such as its level of reliability, its impact on macro objectives and how easy it is to configure it, etc.

For example, let's say that a website is not 'converting' as much as you expected (defining “convert” as actions such as closing a sale or generating a registry). After analyzing all the possible causes for your results, you have determined that changing the call-to-action (CTA) button could influence the result. A possible hypothesis could be that, if you change the color of the call-to-action button, the conversion rate would improve by a 20%.

0

Create an Experiment Using Google Optimize

When you have defined your hypothesis, it is time to install the Google Optimize tool in your website to enable testing. You should have created a Google Optimize account before this. If you do not have one yet, go here and create your free account.

Create a New Experience

Once your account has been created, log in to the platform to start doing A/B tests. In the first place, you should create a new experience, this is where you will configure your experiments.

1

Then, select "A/B test".

2

Add a New Variant

You can add up to five variants per experiment, and they can be edited later.

3

After creating a variant, you have to edit its content; you will need to install the Chrome extension that is available here.

4

Then, click on the Edit Button of the created variant and, if you already have a Google Optimize extension, a web editor will be displayed. We will use this editor to make the changes that we stated in our hypothesis.

5

For our current example, change the color of the button from white to blue, and add an icon to it. Also, rename the Web page as “Version B”. The result obtained should be the following:

8

Also, assign the website traffic redirection value to 50%, so that you can demonstrate your results quickly.

9

Linking Google Analytics to Google Optimize

To link these two services, insert the script below in the index.html file of your project; this will allow the data obtained to be sent to Google Analytics. It is important to insert this script, as it will help you to obtain information on the objectives established for the experiment and demonstrate the results using Google Analytics.




 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');


 ga('create', 'UA-XXXXXXX-X', 'auto');
 ga('require', 'GTM-XXXXXX');
 ga('send', 'pageview');

It is also important for you to install a Google Optimize snippet for the experiment to render the two versions of your website.

10

1. Define the objectives of the experiment.

Now, define the objectives of your experiment, you may choose them from a default list or you may create a personalized objective. This time, we will create a customized objective to register the number of clicks by users in the two versions of the website.

11

For this experiment, the event Label was: “Click Blue Button”

12

Test your experiment configuration

It is important to verify that the configuration is correct; otherwise, the experiment will not render your website's Version B. For this, click on Verify Installation in the Configuration section of the Google Optimize snippet. This message should appear on screen:

13

Send events

Finally, send the click event to google Analytics. To do this, create a service in your Angular project; it will be responsible for triggering the event when you click on the button.

This is the service:

16

After defining the experiment criteria, you will be able to execute it.

17

If you access from the browser to the website, you will see Version B.

19

You can find the Angular project code here.

Concluding the Experiment

To observe the results of our experiment, we can log in to Google Analytics console. In the Event's section, we can check the number of calls to the event created: “Click Blue Button”. This number exceeds the number of times that the white button was clicked in more than 20%, and we could test the hypothesis that we stated for our experiment.

15

How Long should the Experiment Last?

According to Google's official documentation, it is recommended to continue the experiment until at least one of the following conditions has been fulfilled:

  1. That two weeks have elapsed, in order to observe cyclical variations in the web traffic of a whole week.

  2. At least one of the variants must show a 95% probability of exceeding the reference value (current website traffic before making any modifications).

We hope that this article has been useful for you to perform tests on your website and to provide validated knowledge for decision-making in your website's or app design or user flow.

Be the life of the party with the latest information on digital payments.

Subscribe to our Kushki Hub to receive alerts about our new content.

Suscribe illustration
Don't know which product is right for your business?
Does the world of payments catch your attention?

More about our kushki Hub

How unit testing may prevent a disaster in computer systems?

Using unit tests can prevent disasters in computer systems. Learn how. When software developers start our professional path, we generally think about how fun it will be writing code to solve any type of problem or satisfy any needs our customers have. In pursuing such desire, our priorities are usually learning different programming languages, frameworks, design patterns, good practices, as well as other concepts, techniques and tools that will help us to accelerate and optimize code writing and functioning. However, an area that is quite forgotten, especially by startups and small companies in the software development industry, is precisely the establishment of tools allowing for writing, executing and measuring unit and integration testing; many people think that they result in a loss of time. In this article, I will explain why running this type of tests should be an essential part of the routine and discipline of a software developer. To achieve this, it is important to first understand certain concepts and, why not, to write a couple of tests. TDD When we are discussing unit testing, it is necessary to talk about TDD, and acronym for "Test Drive Development". This is an approach that allows developers to write code based on tests that have been previously written. This, with the purpose of making code writing (complying with the test) a natural and fast development. A TDD has the following workflow: As you can see in the chart, a TDD is quite strict regarding the order of what we must do for writing a test. Personally, I do not follow this order rigorously because I consider that each developer can adapt this process to their workflow. For example, in my day to day, I write code as follows: I define the method that I will implement in its respective interface. I write the implementation of the method, so that it returns the response that I expect, regardless of any internal logic. I write the test using super basic assertions, to ensure that the result is not indefinite. I integrate the logic of what my method will do, step by step. At the same time, I add what I need to my test; for example, if my first step is searching for a record in the database, I will make the respective change in the test to simulate that response, and then I will adjust my assertions according to the problem that I'm trying to solve. The step above will become a loop until the complete logic is obtained, similarly when there are conditions or errors that I should test. Finally, I will have to design additional tests to check such cases. Finally, I will adjust the assertions in my tests and perform a final analysis, in case I have to make a small refactoring in my tests or in the code itself. You can write high-quality tests as long as you have in mind what you want to test and why. At the beginning, they could be dark concepts, but will be clarified as you gain practice and experience. Unit Testing It is the validation of the smallest fragment of code, which can be a method or a function or a small class; this will depend a lot on the context where we are located. Below, I will describe in detail how to write a unit test using Mocha framework and an assertion library, Chai, in the backend execution environment of Javascript, Node.js. We will initialize our project in Node, using the following command from the terminal located in the directory that we have selected. bash npm init This command will ask us several things regarding our project, for this example, we will maintain the default values. The important point is that, as a result of the execution of this command, we will obtain the package.json file within the root file of our directory. json { "name": "unittesting", "version": "1.0.0", "description": "simple examples about unit testing with mocha on node.js", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "author": "", "license": "ISC" } Then, we install Mocha and Chai as development units. bash $ npm install --save-dev mocha chai We create in the file service.spec.js within the src directory in the root directory of the project. We write one test with the purpose of creating a function that, after receiving the greetType parameter, if the value is 1, the result of its execution is a friendly greeting with this text: "Hello, how are you sir?” Then, we design another test so that the result, for any other value, will be: "Hi, What's up bro". describe("Unit Test Examples", function() { it("getMessage should greet kindly", function() { const greetType = 1; const response = service.greet(greetType); expect(response).to.be.eqls(`Hello, how are you sir?`); }); it("getMessage should greet", function() { const greetType = 1; const response = service.greet(greetType); expect(response).to.be.eqls(`Hi, What's up bro`); }); }); ``` In this fragment, we import our service.js file, that will contain our getMessage method, then we use describe and it, which are provided by Mocha, to encapsulate our assertions and to write our test. They receive a first parameter that is a description of what they contain, namely, what we are going to test, and a function that will be responsible for executing our tests. We execute our tests by executing the command in the terminal. bash $ npx mocha ./service.spec.js The result, as we have expected, is an error, since we have not yet written the code for the function nor exported it from the service.js file. ```bash Unit Test Examples 1) getMessage should greet kindly 2) getMessage should greet 0 passing (20ms) 2 failing 1) Unit Test Examples getMessage should greet kindly: TypeError: service.greet is not a function at Context.(src\service.spec.js:7:34) 2) Unit Test Examples getMessage should greet: TypeError: service.greet is not a function at Context.(src\service.spec.js:14:34) ``` Type the code of the function that complies with the test in the service.js file within the src directory. javascript module.exports = { greet: function (greetType) { if(greetType === 1) return `Hello, how are you sir?`; else return `Hi, What's up bro`; } }; In this fragment, we simply export the greet function, which receives as an argument a number and returns a message based on that number. We will execute the test again. bash $ npx mocha ./service.spec.js Now we will obtain a satisfactory result. ```bash Unit Test Examples √ getMessage should greet kindly √ getMessage should greet 2 passing (26ms) ``` Let's suppose that we made a code refactorization, and this time, the number that triggers the kind greeting will be 3. javascript module.exports = { greet: function (greetType) { if(greetType === 3) return `Hello, how are you sir?`; else return `Hi, What's up bro`; } }; We will execute the test again. ```bash Unit Test Examples 1) getMessage should greet kindly √ getMessage should greet 1 passing (23ms) 1 failing 1) Unit Test Examples getMessage should greet kindly: AssertionError: expected 'Hi, What\'s up bro' to deeply equal 'Hello, how are you sir?' + expected - actual + -Hi, What's up bro + +Hello, how are you sir? And, as we might expect, this time one of the tests has failed due to the changes that we have made in our function. With this small exercise, we begin to understand what we obtain by writing unit tests for our code. Benefits of Performing Unit Tests Speed. Today, computer systems change faster with time, so they must be adaptable to the requirements they're trying to comply. For example, a simple system for image processing probably will require more processable formats. Unit tests will help us to prevent that any changes that we make in our code affect the use cases that are working without errors or bugs. Quality. For any serious company in the software development business or that depends on software developed in-house, it is crucial to ensure the quality of the code of its applications. Unit tests act as a sieve that will allow us to filter the greatest quantity of potential bugs within their modules, and to correct them in time. Evidently, we will not be able to reduce all these incidents entirely, but this will mitigate them in a large percentage. Makes code analysis and debugging easier. Unit tests can help us to debug our code in a much simpler way. If we have errors in the production environment, and we don't know their cause, we can start executing tests in a local environment and play with the parameters that could be generating the error. This saves us time because we do not have to launch a patch without even knowing if it is going to work. Design. When we think about the things that we have to test, planning the future design of our code is also a side effect. In this case, we will ask ourselves: Should this method go within this class? or, can I disconnect this method using a static class?. The answers to these questions give us feedback to improve the architecture and design of our code, which in turn will result in greater legibility and maintainability for the code. Resource saving. In all industries, time and money are capital factors. The benefits described above are translated into a decrease in the time that developers use to solve bugs, perform changes, adaptations or improvements. This, in turn, allows them to be more productive and generate greater value for the company. An Advice, from Developer to Developer When I started my professional career, I never focused in anything more than writing the code that I needed to solve the problems that my customer's applications required. Most of the time, I spent hours manually testing code to solve bugs or to apply changes to my code. So, one of the biggest challenges that I had to face when I started working in Kushki was adapting to the strict scheme that the company had in place concerning unit tests, as the smallest line of code must be tested. Thus, I learned that, as developers, we have to invest a great percentage of our time in learning how to write tests that generate value for our work teams, our projects, employers and customers. Searching for new testing tools that provide us greater speed, quality, efficiency, security and maintainability is fundamental. The language in which we learn to write these tests is not so important because when technology changes, we will already have strong foundations to be able to migrate without headaches. Conclusion There is an infinite number of technologies and tools that allow us to write unit tests; each work team is responsible for searching and choosing the ones that better adapt to their workflow and to the objectives they try to fulfill, as well as to the different programming languages available in the market of this industry. Even if the concept of unit test is small and concise, it is an extremely powerful resource. As we have seen, there is no excuse to not write unit tests for our projects. Benefits can be noticed from the first moment that we have decided to apply them. Tests help us to understand better the technologies that we are using and the problems that we are solving. In an extreme case, our unit tests can save us from a total disaster; just imagine that a pair of zeros were added or eliminated in a bank transaction, and that this error was executed millions of times before being detected.
Avatar img
Mauricio Morales
Software Developer
julio 28, 2020

COVID-19: A new Challenge to Strengthen and Create Strategies to Ensure Continuity in Customer Service

Covid-19: A new challenge to strengthen and create strategies for the continuity of customer service. The emergence of the coronavirus epidemic (COVID-19) took us all by surprise, causing concern and anxiety. Although as human beings, we constantly adapt to the multiple changes that originate from the dynamics of the world, this new virus conflicted numerous aspects, most of them related to our health, social relations, the labour market, and the economy; among others. To overcome this, at Kushki we had to look for alternatives in the way we work, thinking about the safety of workers and customer satisfaction. And a question emerged: How can we improve customer service in pandemic times? To answer it, we had to think carefully what the needs and requests of our customers are and make changes in our support area, according to them. In this article, we will explore some procedures that made possible the following changes: Regarding our workers' safety, we opted for working home office, thus reducing the exposure of the company personnel to the coronavirus. For this reason, we encouraged measures aimed at decreasing the risk and the spread of contagion. Additionally, we implemented virtual daily follow-up meetings, where we constantly evaluated customer satisfaction indicators. This helped us to develop continuous improvement activities for increasing the service's quality. On the other hand, we enhanced our worker's job skills through courses and customer service trainings in order to promote active listening, which increases efficiency, for meeting the requirements from old and new customers in a more effective way. In this way, we also take care of our customers, providing the necessary equipment to respond to the multiple requests they may have. This is why it was essential to work on rising awareness among the staff through training. It's worth emphasizing the pandemic encouraged businesses that did not previously have technological platforms to seek alternatives, such as our payment gateway, for the development of their commercial activities, and for offering their services and products through electronic applications. This led to an increase in online requests, so training the staff adequately was critical to face the increase in the demand. Today, we continue to work on taking the necessary measures to guarantee a high-quality service for our customers, implementing all the biosafety policies that have been decreed by the governments in the countries where we operate and by our own company. Of course, the COVID-19 pandemic poses big challenges, so we will continue setting clear tasks in order to satisfy the needs of the shops affiliated to our platform, and taking actions for the protection of our workers. Finally, we are continually performing updates according to the progression of the crisis caused by the pandemic, implementing changes in different support processes, reviewing the requests that we receive, evaluating the possible solutions to emerging needs and projecting support strategies in the shortest time possible. Additionally, thanks to the active listening strategy towards our customers, we are performing technical developments in our products according to the requirements and needs that they have expressed. As a company, we need to think and constantly worry about our customers, understanding that they are also being affected by the changes that have come about. Therefore, it is necessary to strengthen and create strategies for ensuring the continuity of our customer service, keeping as a priority the value that we can deliver to them at these moments of hardship, developing the changes we mentioned, where the empowerment and improvement of the electronic service channels will help us to continue giving accurate advice to our customers.
Avatar img
Daniel Castañeda
Analista de Soporte
julio 16, 2020

Self-Service: Key to Obtaining a Successful Customer Experience

Learn more about Self-service Have you been overwhelmed with thousands of customer requests and think that hiring staff is the only solution? Does it scare you to have multiple support channels open to the public? Do you think that customer service can only be provided by your agents? You do not know how to improve customer satisfaction rates? What to do if response and resolution times grow and grow without control? These are only some of the most common questions that service directors often have to solve, and sometimes, the solutions to these issues, rather than complex, are the result of an arduous planning and information analysis process. And you might ask: “Information analysis? How?, I manage everything using Excel and the process control takes up all my time. I can barely generate some reports to measure the service and, now, implementing a service tool to optimize my job will have a very high cost. It's impossible at this moment when cost saving is critical”. The reality is that the most important thing for your service area is information. Based on it, it would be possible to take any measures that bring about a radical change to failures that have been detected inside the service desk. This will be your cornerstone for knowledge building, it will allow users to self-manage their concerns, frequently asked questions, and even to deal with common technical issues in your process or in third parties processes that form part of your service. To start with this, we recommend you to establish a system that not only will help you to receive information from the support channels that you've made available for your users (e-mail, chat, social media, customer service portals, etc.), but also will allow you to perform an adequate analysis of the collected information. Based on this information and its analysis, you will build your knowledge base, which your customers could use to: Self-manage their requirements Provide important information that will help you to improve published content. Rate your publications. The most important thing is that you will give time to your agents to focus on solving more complex issues that can generate greater value for the organization (this will occur in so far as the published information is accurate and as expected by your users). Did you know that 60% of customers seek to solve their incidents or queries by themselves? This increases exponentially their satisfaction levels, and the explanation lies in a very basic but powerful concept: being able to solve any problem without requiring support from a third person, makes human beings feel better about themselves and increases their level of happiness. This type of solutions are best applied in conjunction with a Chat-Bot system, giving users an online experience when answering their queries, fed on the information that you have collected to build your knowledge base, and reducing the workload of your service teams. In conclusion, if your strategy is based on giving the best possible service experience to your customers, you should always consider implementing good tools that allow you to collect as much information as possible about their requests and, based on this information, to create high-level content that they can use to solve their questions. Ideally, you should complement this with a portal that not only provides this customer service, but that also allows you to interact and have a dynamic and two-way communication flow.
Avatar img
Juan Pablo Herrera
VP Service @ Kushki
junio 17, 2020