Skip to main content
What is Traffic Allocation?

A description and technical overview of traffic allocation

Updated over 6 months ago

Description

Traffic allocation allows you to configure what percentage of customers will see UpCart on your storefront.

For a given customer, as long as the traffic allocation setting is not adjusted, they will always either see the cart, or never see the cart. This is even true across sessions.

When the traffic allocation percentage is not 100% you can preview your storefront with the cart enabled or disabled.

Technical Implementation

Traffic allocation functions based on storing a randomly generated number between 0 and 99 inclusive in the browser’s local storage. See below.

In this example, the client generated the random number 96, which means if the UpCart traffic allocation percentage is set to 97%, they will see the cart, but if it’s set to 96%, they will not see it (i.e. the cart is shown using the formula upcart-traffic-allocation-random < upcartSettings.trafficAllocationPercent). Since the random numbers are uniformly distributed, this results in only the given percentage of customers seeing the cart.

To reset this random number for a given client, the record can be directly deleted or edited through dev tools, or the cookies/site data can be cleared for the store.

Did this answer your question?