profileService

Service to retrieve profile counts.

Example
Imports:
"blueconic/api/data/service/profileService"
"blueconic/api/data/domain/Filter",
"blueconic/api/data/domain/FilterConfig",

Usage:
const filter1 = new FilterDO.Builder().property("clickcount").inRange(0, 6).build();
const filter2 = new FilterDO.Builder().property("visits").inRange(1, 2).build();
const filterConfig = new FilterConfigDO.Builder().containsAll([filter1, filter2]).build();

// All parameters are optional; if no options are given, allvisitor count will be returned (E.g. segmentId falls
// back to "allvisitors") annd allowEstimate falls back to OPTIMIZE, so BlueConic balances between full and sample index.
const count = await profileService.getCount({
  segmentId: "allvisitors" // or a segmentId
  refinement: filterConfig, // optional, must be exactly one FilterConfig if passed
  objectiveIds: ['objective_1'], // optional
  allowEstimate: false // can be ommitted so BlueConic will optimize itself
});

// For a given lifecycle stage; mutually exclusive with connectionId and goalId
// adds the filter based on the specific lifecycle stage.
const count = await profileService.getCount({
  segmentId: "allvisitors" // or a segmentId
  refinement: filterConfig,
  objectiveIds: ['objective_1'],
  stageId: "stage UUID here"
});

// For a given connection goal; mutually exclusive with stageId
// checks if the given connection goal has a lifecycle stage attached, and if so, apply those filters as well.
const count = await profileService.getCount({
  segmentId: "allvisitors" // or a segmentId
  refinement: filterConfig,
  objectiveIds: ['objective_1'],
  connectionId: "connection UUID here",
  goalId: "goal UUID here"
});

Functions

asyncgetCount(options)Promise.<number>

Returns the count of profiles for the given input values.

Name Type Description
options Object

the options to retrieve the profile count for. All parameters are optional.

Name Type Description
segmentId string

segment id, default is "allvisitors".

refinement blueconic.api.data.domain.FilterConfig

exactly one blueconic.api.data.domain.FilterConfig, which can be created with blueconic/api/data/domain/FilterConfig.Builder. It is used to extends the refinement, change the resulting Solr query.

objectiveIds Array.<string>

List of objectiveIds that the profiles should match with.

connectionId string

connection id, it is mutually exclusive with stageId.

goalId string

goal id, it is mutually exclusive with stageId.

stageId string

stage id to filter on a stage of a lifecycle, it is mutually exclusive with connection and goalId.

allowEstimate boolean

indicating if an estimate of the values is allowed.

Throws:

TypeError when parameters are invalid

Returns:
Type Description
Promise.<number> returns the profile count