0
votes

We're integrating SAP Commerce 2005 and Spartacus 2.0.3 with CDS (Context-Driven Services). We followed the instructions from https://sap.github.io/spartacus-docs/cds-integration/ and we got it work right.

Nevertheless, we've noticed one issue.

When we clear the site data (either from Chrome DevTool or via browser Settings), the cookie named profile.consent.given is not being set anew while refreshing the page - even though the PROFILE consent has consentState "GIVEN" in local storage in spartacus-local-data > anonymous-consents > consents.

Initially I thought that it's just not visible in DevTools, but when I've added the url parameter ?profileTagDebug=true, in the console there is a log saying:

"[Profile Tag] No cookie found with name profile.consent.given".

When I set this cookie manually with value true, everything starts to work just fine, all other needed cookies and local storage data responsible for tracking users behavior is being set properly.

Do you see any place where we could have done something wrong, which may have caused this cookie to work improperly? Which module or component of Spartacus library would be of any clue in resolving this issue?


Edit: the reason of this strange behavior was in profile tag created by our team in CDS. It contained:

"consentListener": "type":"cookie","cookieName":"profile.consent.given","cookieValue":"true"},

which made the cookie profile.consent.given necessary while it shouldn't be. Using profile tag without this part made all work just fine.

2
When you say that you clear the data, do you also clear the local storage? I'm a bit confused about your flow, because if you clear the site data, you probably also clear the local storage, right?pegasus
Yes, I meant scenario when clearing local storage too. When I'm delete only the cookies, in local storage I still have electronics-spa-consentReferenceToken and profiletag positions, which are making CDS integration work fine. But when I clear all site data, the cookie profile.consent.given is never recreated and as a consequence those positions in local storage are absent too.bjojo

2 Answers

0
votes

Just a quick FYI about the CDS-Spartacus integration: the profile tag script is pulled from the configured URL by Spartacus, and the script is doing all the event and data "scraping". The cookie is also being placed in the browser by the script.

Your question and this comment lead me to think that the script is not handling this case.

I'm not even sure if it should handle it, so it might be a better idea to contact CDS team directly about this one.

0
votes

With Spartacus, this cookie doesn’t make sense anymore. It is created by the Commerce backend and works best in combination with an accelerator frontend. Cds-spartacus in combination with ProfileTag relies on the anonymous consents or the user consents (depending on the user being logged in or not) loaded by Spartacus. More information about anonymous consents can be found here: https://sap.github.io/spartacus-docs/anonymous-consent/.