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

BUG : StorageType none setting entries in local storage #2014

Open
IHtDzenda opened this issue Jan 22, 2025 · 4 comments
Open

BUG : StorageType none setting entries in local storage #2014

IHtDzenda opened this issue Jan 22, 2025 · 4 comments
Assignees
Labels
bug Something isn't working open source PRs or issues originating from the open-source community

Comments

@IHtDzenda
Copy link

IHtDzenda commented Jan 22, 2025

Bug Report: storage.type: none Setting Still Creates Entries in Local Storage

Description

The storage.type: none setting in the @rudderstack/analytics-js SDK does not appear to function as expected. Despite configuring the SDK to use no storage, some entries are still being created and persisted in the local storage. This issue also persists when using memoryStorage as the storage type.

Steps to Reproduce

  1. Create a new React app with TypeScript:
    npm create vite@latest app -- --template react-ts        
    npm install @rudderstack/analytics-js
  2. Modify App.tsx as follows (replace placeholders with appropriate values for WriteKey and DataPlaneUrl):
    import { RudderAnalytics } from '@rudderstack/analytics-js';
    import { useEffect, useState } from 'react';
    
    function App() {
        const [analytics, setAnalytics] = useState<RudderAnalytics>();
    
        useEffect(() => {
            if (!analytics) {
                const initialize = async () => {
                    const { RudderAnalytics } = await import('@rudderstack/analytics-js');
                    const analyticsInstance = new RudderAnalytics();
                    const WriteKey = "YOUR KEY";
                    const DataPlaneUrl = "YOUR URL";
    
                    analyticsInstance.load(
                        WriteKey,
                        DataPlaneUrl,
                        {
                            storage: {
                                type: 'none',
                                entries: {
                                    userId: { type: 'none' },
                                    anonymousId: { type: 'none' },
                                    sessionInfo: { type: 'none' },
                                    groupId: { type: 'none' },
                                    authToken: { type: 'none' },
                                    userTraits: { type: 'none' },
                                    groupTraits: { type: 'none' },
                                    initialReferringDomain: { type: 'none' },
                                    initialReferrer: { type: 'none' },
                                },
                            },
                        }
                    );
    
                    window.rudderanalytics = analyticsInstance;
                    setAnalytics(analyticsInstance);
                };
    
                initialize().catch(console.error);
            }
        }, [analytics]);
    
        return (
            <button onClick={() => analytics?.track("test")}>
                Track
            </button>
        );
    }
    
    export default App;
  3. Open the application in the browser.
  4. Inspect the local storage in Developer Tools and verify that some entries are still present even when storage.type is set to none.

Expected Behavior

When storage.type is set to none, no entries should be created or persist in the local storage.


Observed Behavior

Local storage contains entries despite explicitly configuring storage.type: none. This behavior is unexpected.
Below is a screenshot of the local storage content:

Local Storage Screenshot

Additionally, when memoryStorage is used, the issue persists and entries are still visible in local storage.


Additional Information

  • SDK installation type: NPM
  • SDK version: @rudderstack/analytics-js@^3.11.17
  • Node version: v22.11.0
  • NPM version: 10.9.0
  • Frameworks and Versions: Tested on vite and Next.js 15
  • Bundling Toolset: Not specified

Environment Details

  • Operating System: NixOS
  • Browsers Tested: Firefox, Chromium, Brave (issue is consistent across all)
  • Browser Versions: Latest versions of each browser.

Am i doing something wrong or is it a bug ?
Link to documentation https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/data-storage-cookies/persistent-data-storage/

This report was grammar corrected by chatgpt

@IHtDzenda IHtDzenda added bug Something isn't working open source PRs or issues originating from the open-source community labels Jan 22, 2025
@contributor-support
Copy link

Thanks for opening this issue! We'll get back to you shortly. If it is a bug, please make sure to add steps to reproduce the issue.

@saikumarrs
Copy link
Member

Hello @IHtDzenda
As noted in the documentation the storage type can be configured only for specific persisted data.
https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/data-storage-cookies/persistent-data-storage/#persisted-data

The entries you've pointed out are related to events processing. It is not configurable.
Is there a concern?

@IHtDzenda
Copy link
Author

Is there a concern?

Our primary concern is compliance with EU tracking consent regulations. We use Termly for managing user consent, and we've observed a large number of uncategorized cookies, including those created by RudderStack, even with all storage configurations set to "none."

This complicates our ability to provide users with accurate information about cookie usage. While it would be ideal to have a way to fully disable these cookies, we can work around it if this isn't something you're planning to change.

Below are some screenshots for reference:
Image

Image

Thanks for the quick response 😄

@saikumarrs saikumarrs self-assigned this Jan 22, 2025
@saikumarrs
Copy link
Member

Hi @IHtDzenda
Thanks for providing additional details.

We never had plans to manage these entries in the localstorage via the storage type option as they are purely meant for events processing.

I'll take this up with our product internally. Meanwhile, please use a workaround to ignore these entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working open source PRs or issues originating from the open-source community
Projects
None yet
Development

No branches or pull requests

2 participants