db functionality for click data