The tracking image must not be sent as inline with the email, as what you are counting, to keep track of people who opened your newsletter, is the number of times that image was downloaded / requested from your server.
This means your tracking has a URL that looks like this :
http://www.yoursite.com/tracking.php?id_newsletter=X&user_id=Y
Note, though, that this will only work for users who choose to enable the display of images while looking at your newsletter -- and more and more e-mail clients disable images, by default.
Other tracking solutions ?
Instead of tracking number of views, you could track number of clicks on links.
For example, instead of having a direct link, in your newsletter, that would look like this :
http://www.yoursite.com/destination-page.php
The link would point to a counter / tracking page :
http://www.yoursite.com/track-clicks.php?newsletter_id=X&user_id=Y&destination_page_id=Z
And that track-clicks.php
page would :
- insert some data to the database (or somewhere else), to keep track of the click
- select from the database (or elsewhere) the URL of the page that corresponds to
destination_page_id=Z
- redirect the user to that page.
Tracking clicks, instead of views, has several advantages :
- Even if the number is smaller, you are not tracking users who registered a long time ago and are not interested anymore : you are only keeping track of users who are interested enough to read your newsletter and clicks on links
- This should works much better : even if external images are disabled, users will have to click on your tracking links to access the page that interests them