Sample SDK Integration
A step-by-step run-through of a sample SDK integration using Javascript SDK
This document introduces an example of using JavaScript SDK. The purpose of the introduction is to:
- Know what type of code work is needed.
- Get a hands-on experience of the functions of the SDK.
Example: A simple A/B test
Here's what the example does:
- Receive a random user identifier.
- Press the *Distribute traffic button.
- Perform a traffic distribution of users into different test groups and send a
hackle_test_event_key
event key corresponding to the action of the button being pressed.
Check out example code and link to practice
Examples of SDK Functions after Hackle JavaScript SDK Integration
Tip. Refer to the Javascript SDK documentation to assist your understanding of this exercise.
Things to note
- This sample is based on the sample A/B test generated by Hackle. The sample A/B test has the following characteristics.
- You will be able to try out and view some of the different types of distribution reasons. (Find out more about distribution reasons from the variationDetail table within Traffic Distribution )
- The user is distributed to test group A when apple is inserted as the user identifier and test group B when banana is the user identifier. You can try this out on the link provided.
- If any other value is entered for the user identifier, the test group is determined according to the traffic distribution logic.
- In order to run this example with the A/B test that you created directly from the Hackle Dashboard, you need to edit the SDK key and Experiment key to the one that corresponds to the sample A/B test that is created from the Hackle dashboard in the JS tab.
Updated over 2 years ago