I would like to make a 1 pixel image that will reside on the
html page to track page activity I have a page http:/domain.com/mypage.htm and
I want to add <img src='http://www.test.com/myimage.aspx' /> somewhere in
its body
When page is triggered I render an one pixel transparent
image. I'm having an issue finding out the URL of the page that image is on.
HTTP_REFERER header carrier the true referer of the page, and HTTP_HOST carries
the URL of the image itself.
Is there a way to find out the HTML page URL that the image
is on?
You can analysis the request headers of myimage.aspx, the Referer header is the HTML page URL you're looking for. Besides, I suggest adding a timestamp with the <img> src link, like this:
So that every time you refresh the HTML page, the browser invoke a new request to the image.
If you can't find it on any http header, you can always send some information like <img src='http://www.test.com/myimage.aspx?page=mypage' />.
If you can use javascript though, you don't need to display an image, use an ajax request instead.