Bring your own targeting platform

You can use your own targeting/experimentation platform to determine which test variant your visitors should be in. This guide will walk you through setting this up.

Requires engineering work

Why would I want this?

Many of our merchants use a generalized A/B test platform for non-shipping rate experiments. This feature allows you to utilize the power of ShipScout's shipping rate configurability with your own existing targeting tool.

Step 1 - Set up your test

Create a ShipScout test as you normally would. BYOTP is available to all types of tests: threshold, flat rate and custom.

Step 2 - Enable "Use your own targeting platform"

In the audiences section, enable "Use your own targeting platform".

Step 3 - Integrate your platform

Use the ShipScout javascript SDK to assign a variant to your visitors. For theme based shops, no pre-setup is necessary. For headless shops, you'll need to install the javascript SDK by following this guide: Headless stores.

Here's an example of assigning variant A to all visitors:

// Init ShipScout - this must run before you assign the variant
!function(s) { s.shipscout = s.shipscout || (e, a) => { s.shipscout._queue?.push({ type: e, ...a }); }; s.shipscout._queue = s.shipscout._queue || [];}(window)

// Assign the variant
window.shipscout("assign", {
  variantKey: "A" // all visitors will be assigned to variant A
});

Here's a more plausible example that shows how you might get an assignment from a targeting platform and map it to a ShipScout variant

// Init ShipScout
!function(s) { s.shipscout = s.shipscout || (e, a) => { s.shipscout._queue?.push({ type: e, ...a }); }; s.shipscout._queue = s.shipscout._queue || [];}(window)

// Get assignment from you experimentation platform
const assignment = ExampleTargtingPlatform.getAssignment();

// Map assignment to ShipScout variants. ShipScout variants are always
//  capital letters starting from A.
let shipScoutAssignment;
if (assignment === "12390424") {
  shipScoutAssignment = "A";
} else if (assignment === "4214900") {
  shipScoutAssignment = "B";
}

// Assign the variant
window.shipscout("assign", {
  variantKey: shipScoutAssignment
});

A few things to keep in mind:

  • Once a visitor is assigned to a variant, their assignment will persist for the duration of the test.

  • Once a test ends, the assignment code will noop so you can clean it up at your leisure. But be sure to clean it up before you start your next experiment.

Step 4 - Test your changes

In order to test the assignments, you will need to launch your test. Assignments will not work in draft mode.

Last updated