0
我使用ASP.NET MVC3 C#和我在模型寫了需要的文件和歸檔他們像一個ZIP格式的方法:如何跟蹤從Google Analytics(分析)請求(asp.net mvc3)接收的文件?
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 {}
的ZIP文件上寫的請求,併發送回原來的有人按下Download
按鈕的頁面。
我想跟蹤此Google文件的ZIP文件。
在這種情況下如何做到這一點?
我讀http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55529但在我的情況是太複雜。我不得不在控制器中使用JavaScript對象?
我需要一個建議 謝謝
我明白了,但我已經有一個事件'下載'按鈕,我等待ZIP文件來自Request.Response –
@MichaelSwan,我不明白爲什麼這是有問題的。只需訂閱此下載按鈕/鏈接的點擊事件,並在請求被激發到服務器之前調用'_gaq.push'方法。 –
我不能調用'_gaq.push',因爲我還沒有從請求中動態創建ZIP文件。我沒有靜態ZIP文件。 –