Skip to main content
Skip table of contents

Session Tag

Overview

This Tag is used to send general Session Data from your platform to Popsell.

Tag

HTML
<popsell-session></popsell-session>

Attributes

attribute

description

mandatory

guest-api-key

Provides the Guest API Key to widgets.

Yes

user-session-id

Your session ID, will reset widget context when changed.

No

user-latitude

User latitude

Yes

user-longitude

User longitude

Yes

user-data

JSON containing user account information

Yes *

data-hash

Hash of user-data to ensure data integrity

Yes *

* only if the user is logged in on your platform.

User logged in

If the user is currently logged in on your platform and requires a Popsell account, you must fill several data to allow Popsell to create its own user account, therefore enabling to use widgets features with a user linked to his/her Brand’s user account.

These data are : user_api_key, user-data and data-hash.

user-data

key

description

mandatory

active

0 or 1.
1 sets the user as active, 0 as inactive.

Default : 1

No

ambassador_id_referrer

Popsell ID of his/her sponsor (sponsor or ambassador to which he or she is affiliated)

No

city

Name of the user’s city

No

country

Code of the user’s country (eg. FR)

No

customer_id

User ID in the Brand’s database

No

dob

Date of birth (Y-m-d)

No

email_tmp

User’s email address (see comment below)

Yes/No *

firstname

User’s first-name

Yes/No *

gender

M or F, user’s gender

No

image

URL of user’s avatar

No

lang

User’s language ISO code (eg. fr_FR)

No

lastname

User’s last-name

No

postcode

User’s postcode

No

status

Popsell user role.

default : CLIENT (7)

No

user_api_key

User’s API key

Yes

* At least one of them

The email is stored in an email_tmp field to differentiate it from the email field in the Popsell databases. Temporary emails are associated with users who did not accept the General Terms and Conditions of the Popsell platform (only the brand T&C or a charter limited to the use of the Popsell Widgets). This ensures that no use will be made of it apart from the granted rights.

data-hash

The hash is generated as follows:

  • Concatenate user-data values, sorted by key’s alphabetical order and separated by ':' (the salt is the brand’s Secure Key, as entered in the Popsell Manager, and must never be disclosed),

  • Hash the generated string with sha256 algorithm.

Note : all keys must be lowercase.

Note : salt must only contain hexadecimal values.

hash_hmac('sha256', value1:value2:value3, pack("H*", salt));

Example
salt
CODE
3979244226452948404D6351655468576D5A7134743777217A25432A462D4A61
user-data
JSON
{
  email_tmp: 'example@popsell.com',
  customer_id: 'abc1234',
  lang: 'fr_FR',
  gender: 'F',
  firstname: 'John',
  user_api_key: '5228561f72f3484d59b687f60d0055f22ee0e000'
}
alphabetical key order
JSON
{
  customer_id: 'abc1234',
  email_tmp: 'example@popsell.com',
  firstname: 'John',
  gender: 'F',
  lang: 'fr_FR',
  user_api_key: '5228561f72f3484d59b687f60d0055f22ee0e000'
}
string to hash
CODE
abc1234:example@popsell.com:John:F:fr_FR:5228561f72f3484d59b687f60d0055f22ee0e000
hash
CODE
de10e529dea96ee18527a29cedf3b2ac20264ebd20a5487dd83ca389c4c591b0

Parameters

No URL parameters are required for this tag.

Integration

Guest

HTML
<popsell-session 
    guest-api-key="<guest api key>"
    user-longitude="<longitude>"
    user-latitude="<latitude>"
    >
</popsell-session>

Client

HTML
<popsell-session 
    guest-api-key="<guest api key>"
    user-data="<user data as json string>"
    data-hash="<generated user-data hash>"
    user-longitude="<longitude>"
    user-latitude="<latitude>"
    >
</popsell-session>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.