Donnerstag, 6. August 2009

Caching und Tracking - caching and tracking

Manchmal taucht das Problem auf, dass man gerne Seiten, welche gecached werden tracken will. Problem ist, wie kommt man an die Mischung aus gecachedten und aktuellen Daten?
Hier habe ich den Workaround wie folgt erledigt.
Per Javascript werden für die Seite relevante und gecachedte Daten als Querystring an die URL eines Imagefiles angehängt, welches allerdings auf eine aspx oder php oder jsp Seite verweist. In dieser (bei jedem Aufruf trotz Cache) Seite werden dann aktuelle Daten und Datenbankeintrag ausgeführt sowie Daten aus dem Querystring übernommen. Im Grunde ist es ein IFrame per Imagetag.

Sometimes you might have the problem, that you want to track cached pages. The issue is, how do you get to the mix of cached and runtime data?
I used a kind of work-around to achieve this.
Via javascript you get to the cached (for each tracking item equal) data in the page and then you add those as a query-string to the URL of an image-file that has been added and pointing to a aspx, php or jsp file. In this file you can access the database and enter all runtime data and the query-string data. Basically it is a kind of Iframe made with an image-tag.

<img src="myFile/Log.aspx" border="0" height="1" width="1" />


Im Log.aspx werden dann alle Daten in die Datenbank abgefüllt inkl. Datum, welches dort aktuell ist. Dieser Imagetag kann in jede gechachedte Seite eingefügt werden.

The Log.aspx then runs the database insert with current datetime included, which will be always the runtime one. This image-tag can be inserted to any cached page.

WICHTIG! Kein javascript Datum übergeben, denn dann bekommt man die Clientrechnerzeit, welche durch individuelle Einstellung und Zeitzone stark variiert.
IMPORTANT! Do not enter the javascript datetime, because then you get the client-time, that can differ because of individual settings and time-zones.

Keine Kommentare:

Kommentar veröffentlichen