Question

Set consnet mode with Browser SDK 2.0, difference using between optOut vs. localStorage

  • 17 December 2023
  • 1 reply
  • 75 views

Hi community.

 

I would like to ask how to set consent mode with Browser SDK 2.0.

I need to track events without cookies.

 

I tried optOut setting and localStorage setting.

  1. optOut setting: added a line, amplitude.setOptOut(true);
  2. localStorage setting: added option in initialization code
    amplitude.init(‘API key’, {
    identityStorage : ‘localStorage’}) 

When I tried no1, still I could find AMP_ cookies but I couldn’t find when I tried no2.

So, here are real questions,

  1. Did I try appropriate ways? If not, please let me know how can I track events without cookies.
  2. In that case, I think no2 is the right way to achieve to my purpose. But when I searched ‘localStorage’ in console, I cannot find how can I track events. My ultimate purpose is get as same as possible to GA4 consent mode.

I am not a developer so I have lack of knowledge of implement technical things. So please let me know specifictly how to do.

 

Thanks a lot!

 


1 reply

I find out some more things

  1. localStorage setting blocks opt out cookies. According to documentation it allows every event sent to Amplitude is stored to localStorage. (saveEvents : true)
  2. setOptOut setting opt out all trakings.

But here is the new question 

  1. I set initialization code to
    amplitude.init(‘API key’, {
    saveEvents : true,
    identityStorage : ‘localStorage’})
    , then can’t I track event on my Amplitude app?
    or can I find in localStorage? But still I cannot find kind of events list or whatever.

If I approach badly, please let me know! 

Thanks!

Reply