Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/klevu-core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ export class KlevuConfig {
setConsentGiven(userConsent: boolean) {
this.consentGiven = userConsent
if (userConsent) {
KlevuUserSession.getDefault().generateSession()
if (!this.disableUserSession) {
KlevuUserSession.getDefault().generateSession()
}
Comment on lines +211 to +213
KlevuIpResolver.getDefault().generateIPData()
Comment thread
jerrypena1 marked this conversation as resolved.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,19 @@ export async function kmcRecommendation(
? `&gpid=${options.itemGroupId}`
: ""
}
const userSegments = KlevuUserSession.getDefault().getSegments()

const conf = KlevuConfig.getDefault()
// Only fetch user segments if user session is enabled
const userSegments = conf.disableUserSession
? []
: KlevuUserSession.getDefault().getSegments()
advFilterParams +=
userSegments.length > 0
? `${advFilterParams.length > 0 ? "&" : "?"}sids=${userSegments.join(
","
)}`
: ""

const conf = KlevuConfig.getDefault()

kmcConfig = await get<KlevuKMCRecommendations>(
`${conf.recommendationsApiUrl}${conf.apiKey}/settings/${recommendationId}${advFilterParams}`
)
Expand Down
Loading