Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISSUE - Get rid of clearIdexCache #272

Merged
merged 1 commit into from
Dec 6, 2023
Merged
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
29 changes: 0 additions & 29 deletions src/standard-live-connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ function standardInitialization(liveConnectConfig: LiveConnectConfig, externalSt

const _push = (...args: unknown[]) => processArgs(args, pixelSender, enrichedState, eventBus)

clearIdexCache(eventBus, enrichedState.cookieDomain)

return {
push: _push,
fire: () => _push({}),
Expand Down Expand Up @@ -202,30 +200,3 @@ export function StandardLiveConnect(liveConnectConfig: LiveConnectConfig, extern
// @ts-ignore
return lc
}

// TODO: remove this in next version
function clearIdexCache(bus: EventBus, cookieDomain: string) {
if (window.localStorage) {
try {
for (const key in window.localStorage) {
if (key.startsWith('__li_idex_cache2')) {
localStorage.removeItem(key)
}
}
} catch (e) {
bus.emitErrorWithMessage('ClearIdexLs', 'Failed to clear localStorage', e)
}
}

try {
const allCookies = window.document.cookie.split(';')
for (const cookie of allCookies) {
const key = cookie.split('=')[0].trim()
if (key.startsWith('__li_idex_cache2')) {
document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${cookieDomain}`
}
}
} catch (e) {
bus.emitErrorWithMessage('ClearIdexCookie', 'Failed to clear cookies', e)
}
}
Loading