Email tracking techniques in php
I am doing a newsletter Management in php. I need to track the visitors who opens our newsletter, I have inserted the tracking image in newsletter thats seems to work little.
Using Shift mailer there is option to embed an inline image to newsletter. Is it possible to track using this inline image?
Is 开发者_如何学Gothere any other techniques for tracking email.
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
You can only reliably track opened emails by using an image loaded remotely – ie. from your server. (Even then, mail clients probably block remote images by default)
精彩评论