Monday, 24 April 2017

How to track downloads in angular/node js?

How to track CSV downloads with Angular/Node js?

I am downloading a CSV file(from Node) using Content-Disposition=attachment. My download should always initiate from server side (I don't want to do the download using anchor tags since the data can be quite large and cause memory issues).

But, what are the possible ways of tracking the download and to know when the download is over?

Here are the steps I have followed for tracking the download :

  1. Submitting a form with required parameters.
  2. In my server(node js), getting the parameters and using them to fetch data from external service.
  3. formatting the data and starting the download by using streaming(Content-Disposition is set to attachment and Content-Type is set to application/download).

I tried setting a cookie from server when the download starts and in the client side I am checking for the cookie in regular time intervals to track the download progress.

But, the problem with tracking downloads with Cookie is that : if the users have disabled Cookie in their browser, then download tracking will not work.



via Curious86

No comments:

Post a Comment