Disclaimer. Please access this technical project from a desktop or laptop computer. The formatting may not display optimally on mobile or tablet devices and could potentially hinder your understanding of the content. This project showcases my practical application and knowledge of JavaScript, HTML, CSS, and client-side A/B testing, demonstrating how website experiments can be built and implemented using front-end technologies without requiring a developer.

The website used for demonstration purposes is sourced from Anil Batra, a GA4 and GTM expert. I am not affiliated with Anil Batra or the website in any way. Concepts related to A/B testing and experimentation are inspired by training materials from Conversion Ideas by Ruben de Boer; however, I am not affiliated with Ruben de Boer or Conversion Ideas. While I am not a website developer, I regularly assist with implementing website changes and A/B tests in my professional work, this project is an independent educational demonstration.

Website A/B Testing with JavaScript, HTML & CSS

Project Overview

Kristin Dain, a marketing analyst trained in Power BI, DAX, SQL, Python, and Technical Program Management through Microsoft’s Software & Systems Academy (MSSA), seated beneath a fruit tree outside a corporate building.

Business Consulting & CO.

Business Intelligence Analysts who help organizations leverage data for strategic decision-making.

Introduction

Our Business Consulting & Co. team partnered with an ecommerce client to implement website changes in a A/B testing environment designed to enhance the user experience and support ongoing experimentation efforts. The project involved applying front-end updates using HTML, CSS, and JavaScript. These changes focused on improving the presentation of key information and creating a clearer path for customers to evaluate products and complete purchases. 

Objective

Implement practical webpage updates that align with common A/B testing strategies used in ecommerce conversion optimization. By adjusting elements such as messaging, layout structure, and visual components, the goal was to improve clarity for customers and create measurable opportunities to evaluate how design and content changes influence user behavior and purchasing decisions. 

My Role

Assist senior website developers in developing and applying front-end modifications to an ecommerce page. This included writing and implementing HTML, CSS, and JavaScript updates to adjust page elements and improve the overall user interface. My focus was to ensure the changes were technically sound while supporting the client’s broader experimentation and optimization initiatives. As a Marketing Data Analyst, my role following implementation would be to measure the results of these changes within an A/B testing environment.

Why A/B Testing?

A/B testing allows organizations to make data-driven decisions by comparing different versions of a webpage, feature, or message to determine which performs better. Instead of relying on assumptions, businesses can measure how real users respond to changes. This helps improve user experience, increase conversions, and reduce risk when implementing updates. By continuously testing and learning, organizations can optimize their website and marketing strategies more effectively.

The Cost of Untested Website Changes

Making permanent website changes without testing can be costly and risky. Development teams are often small, expensive to operate, and already stretched thin maintaining systems and delivering new features. Each change request competes for limited developer time, slowing progress and increasing the likelihood that untested updates are pushed live without knowing if they will improve performance, or make things worse.

By supporting technical teams with front-end implementation and experimentation preparation, I help reduce this burden. At the same time, I assist leadership, including directors and VPs, by translating testing insights into strategic recommendations that guide more effective, data-driven website decisions.

Implemented Page Changes

  1. First, the promotional badge in the top-left corner of the product image was updated from “Sale!” to “NEW”, demonstrating how text elements can be dynamically replaced.

  2. Next, the product information section was improved by replacing the placeholder text (“This is a simple product”) with the actual product description, positioning it directly under the product name and price to provide users with immediate context about the item.

  3. The primary call-to-action button color was changed from purple to green using JavaScript (though the same change could also be implemented with CSS), illustrating how styling updates can be applied dynamically.

  4. In the product information tabs, the Description tab was removed, causing the remaining tabs to shift left. A new tab titled “Shipping and Returns” was added to provide customers with additional purchasing information.

  5. Within the Additional Information section, the product details table was expanded by adding rows for Fabric and Care, improving the completeness of the product specifications.

  6. Finally, the Related Products section was reorganized by repositioning the Sunglasses product before Belts and replacing the default product image with a bundle image, demonstrating how elements can be reordered and updated. The href attribute of relevant links was also modified to support these changes.

Before

Original ecommerce product page featuring a peach-colored beanie, used as the control version in an A/B split test supported by Kristin Dain, a marketing analyst specializing in HTML, CSS, JavaScript, and conversion optimization.

After‍ ‍

A/B test variation of an ecommerce product page featuring a peach-colored beanie, showcasing Kristin Dain's technical support using HTML, CSS, and JavaScript for website experimentation and conversion rate optimization.

CSS

Controls how the webpage looks. It manages colors, fonts, spacing, and layout to create a clean and consistent design. This ensures the website is visually appealing and easy for visitors to read and navigate.

JavaScript

Makes the website interactive. It powers actions like button clicks, form responses, and dynamic updates. It also enables tracking and testing features, helping teams measure user behavior and improve the overall experience.

HTML

Builds the foundation of a webpage. It organizes the content—such as headings, text, images, and videos—so everything appears in the right place. Think of it as the structure that holds the entire page together.

Scripts Used:

Data Gathering Scripts:

Accurate data tracking is essential for reliable A/B testing because results must reflect what users actually experienced on the website. User behavior should only be recorded after the test variation has fully loaded and is visible to the visitor. If tracking occurs before the variation appears, the data may attribute behavior to a version the user never saw, leading to misleading conclusions. Because each A/B testing tool is different, the specific tracking requirements and implementation methods may vary.

Script Templates:

These are practical references I frequently use when implementing A/B testing changes. They include commonly used HTML structures, CSS selectors and properties, and JavaScript methods that help identify elements, modify content, adjust styling, and control user interactions on a webpage.