Sdk

Sdk

new Sdk()

Source:

Constructor of Pinpoll Sdk

Methods

(static) ping() → {void}

Source:

Pings the sdk which logs 'pong' in the console if reachable

Returns:
Type
void

setAttributes(attributes) → {void}

Source:

Set attributes object

Parameters:
Name Type Description
attributes Object.<string, string>

Attributes object in the form key:value

Returns:
Type
void

addAudience(audience) → {void}

Source:

Add audience to addedAudiences array

Parameters:
Name Type Description
audience object

Audience Object

Properties
Name Type Attributes Default Description
id number

Id of the audience (must be a valid id!)

affinityScore number <optional>
1

Optional Affinity Score (Range 1-10, where 10 is the highest)

Returns:
Type
void

addAudiences(audiences) → {void}

Source:

Add audiences to addedAudiences array

Parameters:
Name Type Description
audiences Array.<Object>

Audiences array with audience objects with the properties id and an optional affinityScore

Returns:
Type
void

removeAudience(audience) → {void}

Source:

Add audience too removedAudiences array

Parameters:
Name Type Description
audience object

Audience Object

Properties
Name Type Attributes Default Description
id number

Id of the audience (must be a valid id!)

affinityScore number <optional>
null

Optional Affinity Score (This will only remove the audience with exact match of affinity score)

Returns:
Type
void

removeAudiences(audiences) → {void}

Source:

Add audiences to removedAudiences array

Parameters:
Name Type Description
audiences Array.<Object>

Audiences array with audience objects with the properties id and an optional affinityScore

Returns:
Type
void

(async) sendData() → {void}

Source:

Send data to endpoint

Returns:
Type
void

(async) getAudiences(options) → {Object.<string, Array.<Audience>>}

Source:

Get audiences of current visitor

Parameters:
Name Type Description
options Object

Options how to display audiences

Properties
Name Type Default Description
tree boolean true

Display audiences as tree structure

removeRootLevel string 'none'

Remove root level audiences ['interests', 'properties', 'all', 'none']

onlyLabels boolean | string false

Show only labels of one specific language ['en', 'de', false]

Returns:

Audiences of the current visitor divided in interests and properties

Type
Object.<string, Array.<Audience>>