I'm using ASP.NET MVC3 C# and I wrote in model a method which takes the files and archive them in a ZIP format like:
HttpContext.Current.Response.ContentType = "application/zip";
HttpContext.Current.Response.AddHeader( "content-disposition", "filename=" + myFilename );
ZipForge zip = new ZipForge();
try {
zip.FileName = Path.Combine( folder, myFilename );
zip.OpenArchive( System.IO.FileMode.Create );
zip.BaseDir = Path.GetPathRoot( aPath );
zip.Options.StorePath = StorePathMode.NoPath;
zip.AddFiles( file1 );
zip.AddFiles( file2 );
zip.CloseArchive();
HttpContext.Current.Response.WriteFile( zip.FileName );
} catch {}
The ZIP file is wrote on Request and send back to original page where someone pressed on Download
button.
I want to track this ZIP file for Google Analytics.
How to do that in this case ?
I read http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55529 but in my case is too complicate.
I have to use a Javascript object in Controller ?
I need an advice Thank you