For developers, by developers
Taplytics offers a code-based solution to run experiments on your project. This is a quick overview on how to implement code-based experiments using the same Taplytics SDK as our interactive alternative.
Note: You can run both types of experiments within the same project.
You will need to have the Taplytics SDK installed in your application. You can do this with CocoaPods or manual installation. In addition, your project API key must also be inserted.
The steps for creating a code experiment are exactly the same as that of creating a visual experiment. Depending on your needs, you can use either type or both types to build complex and powerful experiments.
To get started with your code-based experiment, click the "Code Blocks" link in the left-hand navigation menu.
Once you are on the page for setting up your Code Block, the first thing you need to do is define your variations. Like our Visual A/B tests you can create as many variations as you'd like. Just click the "Add Variation" button on the right-hand side of the screen.
Once you have the number of variations you are looking to use, give each of them a descriptive name so you can keep track of them easily.
One of the great parts of Code Blocks is that you can set variables outside of the code. You can then push them to your app to do fun things like deliver in-app messages or adjust values for game dynamics.
To get started with variables just click the "Add new Variable" link on the left-hand side of the Code Block screen.
You can add as many variables as you'd like. Like the variations, give each variable a descriptive name and an appropriate value.
Once you have your variations and variables set up just the way you'd like them, Taplytics generates a code snippet for you to use in your own code.
All you have to do now is place this code snippet wherever you want the experiment to run in your app. Then, make sure the code for the different variations goes into their corresponding sections of the Code Block.
Now that you have your experiment all set up in code, you'll want to get goals set up, too. You can still use "Visual Goals" as long as the buttons are in views that aren't being modified by the experiment. To learn how to do that, feel free to check out the Visual Experiment section.
Since you're already creating your experiment in code though, I'm guessing you're the type of person that wants maximum flexibility and power with your goals too. Well, look no further than the "Code Goals" section of the experiment editor.
Here, you'll see a button that says “Create My First Code Goal.” Go ahead, click it.
This is nearly the same process as the rest of the code block. Add in as many goals as you'd like and give them each a descriptive name. You can also set code goals with a type of either "maximize" or "minimize". This gives you the flexibility to set goals where the objective is to either have more or less of the specified goal metric. This can be useful in cases where you are trying to reduce friction points in your funnel.
Once you've selected your goals, Taplytics will provide a code snippet that you can place in your app. You'll notice that there are two snippets for the each goal. That's because you can have any goal as a a standalone event or you can pass a value into it. This is useful for those of you with retail apps where you want to track how your experiments affect actual sales.
This step is identical to the one in the "Visual Experiments" section. To set your distribution, click the "Distribution" link in the left-hand navigation menu.
To determine your experiment distribution, you need to determine if you want to use a filter to target a certain segment of your users or deliver it to everyone. If you decide to filter, you can filter by iOS version, app version, or device type. Once you have set your desired filter you can choose any breakdown you'd like. We suggest an even distribution to start, unless you are planning on doing a roll-out.
Ready to send your Code Experiment out to the masses? All you have to do now is click the "Let's Run This Experiment" button and it will go live to your users!