rehanvdm / serverless-website-analytics

A CDK construct that consists of a serverless backend, frontend and client side code to track website analytics
GNU General Public License v2.0
167 stars 13 forks source link

Add option to view by hour/day #58

Open rehanvdm opened 11 months ago

rehanvdm commented 11 months ago

This is currently decided for you by the logic here

If it is < 3 days then it will get data by the hour otherwise by the day.

Sometimes you want to look at a weeks data and see spikes to identify when traffic orginated

Make this a drop-down on the chart

rohitverma007 commented 11 months ago

may i attempt this?

rehanvdm commented 11 months ago

@rohitverma007 Yes that would be great thanks. Can you maybe hold off starting on it till next week?

I am busy with https://github.com/rehanvdm/serverless-website-analytics/issues/9 and have refactored the chart component, so once that is merged I will ping you.

rehanvdm commented 11 months ago

@rohitverma007 That work is pretty much done https://github.com/rehanvdm/serverless-website-analytics/pull/59 but I am still to self-review the PR. You can branch off the add-events branch when you start this feature.

So you will see that there is a selector prop on the chart component already and that I think you could just make that an array and then handle the click and everything else similar to what the existing one does.

image

Let me know if you require assistance/pain points. Not sure if I have documented enough in https://github.com/rehanvdm/serverless-website-analytics/blob/main/docs/CONTRIBUTING.md

I don't think I have. But you can locally spin up the backend and frontend for development.

npm install
cd src/src/ && npm install 
cd src/src/frontend && npm install 

For testing locally, it will require you to use a deployed serverless-website-analytics component. Fill in your data in the tsrc/src/test-config.ts file.

Then to run the backend:

cd src/src
npm run start-local-api-front

To run the frontend:

cd src/src/frontend
npm run dev
rehanvdm commented 11 months ago

Actually, I see the contributing doc had that in 😅. That feature has been done and is merged now. There shouldn't be any big changes like this one again. Let me know if you still want to do this one?