Segmentation

This is for:

Developer
In this article

Are segments cross-device?

Segment membership is currently not cross-device, except for segments which use external data imported into our Data Store.

For segments which use external data, if the imported join user identifier is device common, segments can target the visitor on any device where the identifier is seen based on a deterministic match. For instance, if a CRM gold customer’s dataset is imported keyed on user Ids, and these user Ids are common on mobile and desktop, the visitor will enter the segment on both devices.

Can custom fields be created in Simple or Advanced builder?

In the Simple builder you’re restricted to the list of currently supported conditions. In a future release, support for custom QProtocol schema in the segment builder UI will be provided, and it will be possible to edit the underlying segment specification to have full flexibility on the segmentation fields.

For more advanced and custom segments, we recommend you use the Advanced builder.

Can external data be used when building segments?

Yes. It’s possible to use Qubit Import to upload a dataset containing external segment memberships. You can then target these users by selecting the Imports condition. See our tutorial Using Imported Data to Create Segments.

Can segments be analyzed in Qubit’s Data Store?

When visitors enter and leave segments, a segmentMembershipChangedEvent is generated, indicating which segment was entered or left, by which visitor, and in which context, e.g what was their state, what pages were they browsing, etc. This information can be joined to all other visitor events used for analysis, to answer questions such as:

  • Which referrers do visitors in the Mobile visitors from France segment come from compared to visitors in other segments?

  • What are the most purchased products by visitors in the VIP segment?

  • What’s the Exit Feedback left by visitors in the NPS Detractors segment?

  • What’s the average number of sessions before purchase for visitors in the Accessories Purchasers segment?

This functionality is available to all customers who have access to QProtocol events via Live Tap.

What’s the impact of Adaptive Targeting on site performance?

When Adaptive Targeting is enabled, an additional piece of code is included in the Qubit SmartServe bundle to facilitate dynamic segmentation. This code will only execute if segments have been defined in either the Simple builder or Advanced builder. If segments haven’t been created there will be no observable change in the client-side runtime.

If segments are defined, we collect a tiny amount of state from the user’s activity related to the conditions in the active segments. This could include things like whether they have purchased relevant products or counts of how many times they have performed a particular action. The contents of this state is directly correlated with the number of segments defined and their complexity. If there are less than 20 segments, the content will be very small, if there are 100+ it will be much larger. A number of methods are used to ensure that this state is kept as small as possible.

Segment references, condition flags, and numbers each have their own encoding which should result in the smallest data size necessary for the required state. This state is primarily stored within the qb_permanent cookie.

For reporting purposes, it’s also sent to the Adaptive Targeting back-end on change. The number of changes is heavily dependent on the type of segments defined. In typical circumstances, the change is once per page load. The request is slightly delayed from the page load to avoid interfering with initial load and rendering times, and should be very small, less than 250B.

Is it possible to automate the upload of segmentation data?

Depending on your licensing agreement with Qubit, it’s possible to upload a .csv file manually. We also provide the possibility to automate the upload process through a programmatic upload to GCS. See Importing Your Data for further details.

Where’s segment membership stored? Can it be accessed server-side?

Each user’s segment membership is stored in their cookie for performance reasons. Depending on your licensing agreement with Qubit, it’s also possible to synchronize segment membership to our Data Store for server-side access.

For each visitor, a JSON object is saved, against their visitor Id in Stash. This object contains their segment membership, keyed on segment ID, available on app.qubit URLs.

This information can be retrieved by calling the Stash API.

For example:

https://stash.qubitproducts.com/stash/v1.1/kv/set/{propertyId}/public/current-memberships-{visitorId}

  • visitorId (for example, q4uxgr5476o-0iqdtenou-wrevlqn) is the first value stored in qb_permanent cookie

  • You can extract the visitor Id from the cookie by applying this regex: /qb_permanent=([^:])/+

You must use a JSON parser library to convert the data field back into a queryable object.

What are Qubit’s SLAs for Memberships API?

Information on our standard SLAs can be found here.

We commit to SLAs regarding data collection uptimes and user interface uptimes as these are within our control. Any sort of round-trip time, or other latency, is outside of our control.

Is it possible to report on which visitors saw a specific experience?

We have a dedicated export to meet this customer need. See Experiences - Customer Breakdown Export

Is it possible to implement personalization based on Qubit segmentation data via JavaScript?

We can use the membership state in the user’s cookie to query whether the user is a member of the segment that the experience is targeting.

By wrapping the request in the Qubit poller module, we can wait for the evaluation of that query before triggering the personalization.

Look at the following example:

poller(['window.__qubit.segments.isMemberOf']).then(function ([isMemberOf]) {
    const isMember = isMemberOf(options.data.segment)
    if (isMember || options.meta.isPreview) {
      listen()
    }
  })

When Smartserve loads, how do we know which segment a user is in?

Qubit’s Experiences uses an internal API, so you can immediately target an experience from segment membership.

If we upload customer data keyed on their customer Id, is it possible to build a segment that knows to query that key for a specific value?

Yes. It’s possible to use user.id from the QProtocol events generated in a browser and match based on that.

What’s the impact of determining which segment a visitor is in?

We bit mask values into characters, so if we have conditions in segments like has spent more than $500 and visited a certain page, they can all be compressed into a single character.

When you create segments, we create a segment index that’s included in Smartserve. This is a hyper-optimized blob of what fields we care about in which events. Then, when running in Smartserve, we process that subset and set a tiny amount of state in a cookie.

When you create an experience, you can select which segments to include and exclude. If you upload data, we can create the segment in the UI and include this in the experience. Generally, this check is included in Smartserve, as we look for the events on site. This is why there’s no client-side request for segment membership.

For segments based on location, how’s a user’s location determined?

We use a 3rd party solution. If you append ?qubit_debugger to the end of a live segment’s URL, you can use the debugger tool to look at the data coming through. The tooltip on the right of the page lists each event as it’s detected.

How are segment memberships created? Is it by Fully Qualified Domain Name (FQDN) or by Internet Protocol (IP)?

Segment definitions and the Segmentation Engine are held within the Smartserve script. As a visitor performs actions on a page, QProtocol events are emitted. The Segmentation Engine evaluates these events, in real time, and determines whether that visitor should fall into or out of a segment. A user’s segment membership is communicated to Qubit’s back end using segmentMembershipChanged QProtocol events.

Which segments require HTTP interaction with a Qubit API and how often do they contact your servers?

Once per session. We look up geolocation and elements of visitor history, including:

  • sessionNumber

  • number of conversions

  • when the visitor was first seen

  • when they were last seen

  • what their lifetime value is

  • when they last converted

What are the endpoints for the Segment Membership API?

We recommend using the PHP library for querying a user’s membership. Technically, it’s just calling into a specific area of Stash, but the keys may be subject to change and shouldn’t be considered a public API.

If a visitor has been added to an uploaded segment and returns to the site but is not logged in, will they be added to that segment?

Yes, but it can be session limited.

If a visitor is on a site when a new segment is uploaded, will their experience change on-the-fly?

No, the segment will not go live until smartserve.js is published.

If a user’s on-site activity places them in a new segment and that segment has a different experience, will the visitor see the new experience immediately or on the next page load?

In this scenario, the visitor will be immediately served the new experience.

Is there any risk involved in creating advanced segments?

The advanced editor is heavily secured to ensure that regardless of what’s entered as code, it can’t negatively impact a site. The worst case scenario is that a segment code is wrong or has conflicting conditions so no visitors enter the segment. This will be visible from the segment metrics page.

Why base all the key metrics on yesterday’s data?

Tying changes to key metrics such as RPV and AOV over the lifetime of a segment that result from changes to a site, such as a sale, event, or personalized experience to discernible changes in visitor behavior is a real challenge.

By focusing on recent-past data, we’re able to more easily detect and report on positive and negative behavioral spikes than when basing our calculations on a relatively longer period of time.

Why does some of the reported data include characters such as \r, \n, or URL encoded values?

Data shown in the vertical specific metrics modules, such as top products and categories comes straight from the QProtocol data we collect from a site. We do not clean the data so we have the most accurate view of what’s happening on your site and in the segment.

Why are some of my metrics empty?

This is typically due to issues related to the collection of site data.

Your first port of call, when resolving data collection issues is the Validation dashboard, which will help you identify issues for speedy resolution.

Failing that, reach out to your CSM at Qubit.

How can I target the individual nations in the United Kingdom?

This can be achieved by passing the list of region codes associated with each nation in the UK into your segment condition.

For example, to build a segment to target people in Wales, you could use the following XML code:

<segment>
<timeout type="session">
<condition
event="qubit.session"
path="ipLocation.regionCode"
type="String"
op="in"
value="25484,25338,25367,25350,25493,25455,25351,25418,25388,25383,25413,25525,25551,25477,25458,25473,25489,25380,25532,25369,25535,25385"
/>
</timeout>
</segment>

Refer to the following table:

Region Nation

25500

England

25347

England

25358

England

25346

England

28399

England

25361

England

25409

England

25366

England

25397

England

25381

England

25474

England

25359

England

25344

England

25531

England

25447

England

28404

England

25490

England

25542

England

25430

England

25450

England

25352

England

25379

England

25475

England

25472

England

25382

England

25405

England

25464

England

25549

England

25527

England

25360

England

25427

England

25548

England

25387

England

25386

England

25389

England

25524

England

25357

England

25438

England

25537

England

25510

England

25547

England

25526

England

25466

England

28400

England

25408

England

25423

England

25353

England

25439

England

25498

England

25536

England

25480

England

25515

England

25545

England

25487

England

25443

England

25398

England

25530

England

25426

England

25507

England

25419

England

25436

England

25428

England

25492

England

25503

England

25511

England

25441

England

25509

England

25520

England

25368

England

25540

England

25521

England

25514

England

25394

England

25372

England

25446

England

25421

England

25506

England

25504

England

25529

England

25488

England

28405

England

25491

England

25486

England

25483

England

25435

England

25456

England

25476

England

25431

England

25384

England

25453

England

28401

England

25422

England

25497

England

25362

England

25461

England

25449

England

25554

England

25434

England

25463

England

25523

England

25518

England

25544

England

25420

England

25508

England

25539

England

25437

England

28402

England

25442

England

25541

England

25444

England

25546

England

28403

England

25478

England

25499

England

25414

England

25528

England

25407

England

25513

England

25516

England

25553

England

25416

England

25355

England

25363

England

25399

England

25365

England

25495

England

25445

England

25343

England

25429

England

25348

England

25470

England

25417

England

25371

England

25364

England

25392

England

25375

England

25451

England

25550

England

25432

England

25378

England

25522

England

25465

England

25505

England

25468

England

25425

England

25440

England

25345

England

25494

England

25534

England

25533

England

25552

England

25342

Northern Ireland

28409

Northern Ireland

25374

Northern Ireland

25395

Northern Ireland

25411

Northern Ireland

28407

Northern Ireland

25517

Northern Ireland

25479

Northern Ireland

25349

Northern Ireland

25377

Northern Ireland

25373

Northern Ireland

25390

Northern Ireland

25340

Northern Ireland

25448

Northern Ireland

25370

Northern Ireland

25396

Northern Ireland

25452

Northern Ireland

25462

Northern Ireland

25481

Northern Ireland

28406

Northern Ireland

28408

Northern Ireland

25356

Northern Ireland

25354

Northern Ireland

25471

Northern Ireland

25459

Northern Ireland

25341

Northern Ireland

25336

Scotland

25335

Scotland

25337

Scotland

25410

Scotland

25376

Scotland

25403

Scotland

25457

Scotland

25543

Scotland

25412

Scotland

25401

Scotland

25467

Scotland

25454

Scotland

25485

Scotland

25424

Scotland

25460

Scotland

25400

Scotland

25433

Scotland

25406

Scotland

25393

Scotland

25519

Scotland

25496

Scotland

25391

Scotland

25402

Scotland

25501

Scotland

25512

Scotland

25538

Scotland

25502

Scotland

25415

Scotland

25339

Scotland

25482

Scotland

25555

Scotland

25404

Scotland

25484

Wales

25338

Wales

25367

Wales

25350

Wales

25493

Wales

25455

Wales

25351

Wales

25418

Wales

25388

Wales

25383

Wales

25413

Wales

25525

Wales

25551

Wales

25477

Wales

25458

Wales

25473

Wales

25489

Wales

25380

Wales

25532

Wales

25369

Wales

25535

Wales

25385

Wales