This chapter documents the basics of Buncbbox.
- Based on the active experiments and its variants Bunchbox decides if the current page is part of an experiment. If necessary a variant is applied to the current page.
- On the other hand it collects information about the current page and sends it to Bunchbox. This includes tracking conversions for active experiments if the goal conditions are met.
Bunchbox is added to the website with a regular scrip tag. For best performance this script tag needs to be added in a certain way:
document.createElement("script");) because that implicitely loads the script asynchronously as well
- It should be added as far up the document's HTML as possible, at the beginning of the
<head>section if possible.
- It is implemented protocol-free starting with
//. This means it will always use the website's protocol, HTTP or HTTPS. It is always as secure as it needs to be.
A sample Bunchbox code looks like this: (Do not use this example)
Bunchbox can be supplied with additional information about the current visitor with attributes. These attribute can be used for targeting and goal conditions. Since Bunchbox executes its code immediately it is necessary to provide these attribute before the Bunchbox tag is loaded.
The following example demonstrates how attributes are supplied to Bunchbox:
<script> var _bb = _bb || ; _bb.push(["attribute", "gender", "m"]); _bb.push(["attribute", "vipMember", true]); _bb.push(["attribute", "orderSize", 99.95]); _bb.push(["attribute", "productIds", ["12345", "12344", "12345"]]); </script> <script src="//core.bunchbox.co/1352632f4ad7ed4458a43115.min.js"></script>
Attributes can be of one of four types:
- String lists
First, all experiment data for the script's account is loaded and initialized.
- Every experiment is checked to determine if it applies to the current page.
- In case the page conditions are met a variant is determined. In case the visitor has been part of the experiment before he becomes part of the same variant as before. Otherwise a random variant is determined and stored in the cookie.
- This information about the visitor being or becoming part of the experiment is sent to the Bunchbox server.
- Every experiment is checked again to determine if a goal's condition are met. If that is the case the conversion is tracked by sending information to the Bunchbox server.
- If the goal is marked as the final goal of the experiment the information about the visitor's participation in this experiment is removed. The visitor can from now on start the experiment over again