karthick
karthick

Reputation: 6158

How to store data locally?

I am building web analytics tools which deal with tracking the click events and mouse movements, For this, I don't want to send the data to the server for every mouse move or click, instead I planned to save locally and send the data to the server at session time out or while closing the browser or tab (closing the web site).

Note: Large amount of data is to be stored locally.

I know some possible ways to store the data locally.

 1.LocalStorage:
      Drawbacks:  Domain Specific so i can't rely on this.

 2.Cookie
     Drawbacks: 1.Analytics fails if cookie is disabled
                2.Not possible to store large amount of data
                     (scenario: Every mouse movement 
                      co-ordinates should be captured)

I have two questions:

1.Whether storing data locally is good practice (specifically with web analytics)?

2.Is there any other possible ways of storing large amount (cannot assume) of data locally?

Upvotes: 2

Views: 2290

Answers (1)

Hexodus
Hexodus

Reputation: 12927

At least Safari and Chrome have a Web SQL Database API so you'll be able to use sqlite instead of raw local storage. I found a good article about sqlite usage in web browser.

An other option would be to keep your data straight in memory (and push it to the server when a certain size is reached).

Upvotes: 1

Related Questions