Campaigns
Campaign types
Full-stack A/B tests
4 min
full stack a/b tests allow using personizely's js api to run custom tests right within your code configuration variations each a/b test campaign in {{brand}} has an original variation by default, which acts as a control group visitors who see this variation won't see any changes, but a view is going to be recorded then you can add multiple variations to a campaign and assign each of them a percentage share the sum of all shares will always be 100 editing each variation opens up a view where you can enable or disable features and define parameter values that will later be used on the frontend pages the pages the campaign should run on pages are a separate entity that can be reused across campaigns a campaign can run across multiple pages to make the messaging consistent here is what defines a page name a distinctive name for your page, so you can later easily understand which page is which good examples would be pricing, product page, homepage page type as mentioned above, every page can be configured to actually include a single page or multiple pages this works best for dynamic pages that are different by having a lot in common like product or collection pages single page when using the single page type, you only have to specify the page that you want to personalize by specifying the whole url in the page url field advanced when using the advanced page type, you can make the page actually match more pages on your website this would be done by specifying the rules that a page should satisfy in order to match all pages acts as a placeholder in case you want the campaign to run on all pages usually useful when you need to adjust elements present on all site pages, like navigation bars, footers, etc besides specifying the rules, you should also specify the editor url where the website editing will take place goals setting up goals for your campaign allows you to track the performance of the campaign you can set up multiple goals a campaign requires at least one goal, and one of the goals can be set us a favorite, which will make it selected by default in this campaign's report/analytics once a visitor sees one of the variations of a campaign, the campaign is going to be assigned a view then, if this visitor reaches one of the goals specified in the campaign settings, the campaign is going to be assigned a conversion this breakdown can be seen on the campaign's report page usage to run the full stack campaign in your code, {{brand}} exposes the following functions ply runcampaign(id) this method runs a campaign and returns the campaign variation instance if not on control, and null if the user falls into the control group (make sure the campaign you are running is of full stack type) id the campaign id (you can find it in the address bar when editing the campaign) variation getfeature(key) returns the feature instance within the variation key the feature key as specified when creating it feature isenabled() returns true or false depending on whether the feature is enabled for the current variation feature getparameter(key) returns the value of the parameter of the feature within the current variation key the key of the parameter as specified when defining the variation example const variation = ply runcampaign(1); // 1 is the campaign id if (variation) { const cartfeature = variation getfeature('cart'); // is the feature id/key if (cartfeature isenabled()) { const message = cartfeature getparametervalue('message'); // message is the feature parameter this notification queryselector(' cart notification heading') childnodes\[1] textcontent = message; } }