PHP Classes
elePHPant
Icontem

PHP Email Tracking: Record opened email messages using tracking pixels

Recommend this page to a friend!
  Info   View files Documentation   Demos   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2015-06-19 (1 year ago) RSS 2.0 feedNot enough user ratingsTotal: 513 This week: 1All time: 5,463 This week: 1,047Up
Version License PHP version Categories
email-tracking 1.0MIT/X Consortium ...5.3Email, PHP 5, Databases, Graphics, St...
Description Author

This class can record opened email messages using tracking pixels.

It can serve an image file that would be displayed in an email message when the user opens the message.

The class records each access to the tracking image in a SQLite database accessed using PDO.

It takes the current request parameters message tracking values that are stored in the database like the email address and the message subject.

Only the first access to the tracking image is recorded. Subsequent accesses to the same image will be ignored.

Innovation Award
PHP Programming Innovation award nominee
July 2015
Number 9
One common way to track the users that receive and open mailing list messages is to put an image on the HTML part of the message that will be retrieved dynamically from the server.

This class can generate tracking images to put on mailing list messages and records the messages that are opened in a SQLite database.

Manuel Lemos
Picture of Tyler Heshka
  Performance   Level  
Name: Tyler Heshka <contact>
Classes: 2 packages by
Country: Canada Canada
Innovation award
Innovation award
Nominee: 1x

Details

EmailTrack

This simple PHP class outputs a ghost image and uses PDO & SQLite to track whether or not an email has been seen.

REQUIREMENTS

  • PHP 5.3+
  • PDO_SQLITE driver

CONCEPT

Wherever you send an email that needs to be tracked, we’ll just inject an image that ACTUALLY loads a PHP file on our server. The PHP class that is requested in the <img... tag, takes $_GET parameters, logs them in the SQLite database, then serves up an actual image.

PARAMETERS

$message .= '<img src="/src/blank.php?log=true&subject='.urlencode($subject).'&email='.urlencode($to).'" alt="EmailTrack"/>';

| Key | Value | |-------------|---------------------| | ?log | true | | &subject | urlencode($subject) | | &email | urlencode($to) |

INSTALLATION

  • Full instructions and examples are located in the examples folder.
  • The class file resides in src/blank.php
  • You may need to edit paths to the SQLite database/gif in the class settings.
  • SQLite databases can pose a security risk, and may be downloaded with a direct link! Please take precautions to secure the file. You can so this with Apache .htaccess or by making the file hidden.

DEMO

Working Demo: http://tyrexi.us/EmailTrack

LICENSE

This work is licensed by The MIT License (MIT) http://opensource.org/licenses/MIT

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributing

  • Create a Fork of the main branch.
  • Clone the repository $ git clone http://github.com/yourusername/EmailTrack
  • Add a connection to the repository.$ git remote add origin http://github.com/theshka/EmailTrack
  • Make changes to files.
  • git add and git commit those changes
  • git push them back to github. These will go to your version of the repository.
  • Submit a pull-request
  EmailTrack DemoExternal page  
  Files folder image Files  
File Role Description
Files folder imagedata (1 file)
Files folder imageexamples (2 files, 1 directory)
Files folder imagesrc (1 file, 1 directory)
Accessible without login Plain text file changelog.txt Data Documentation
Accessible without login HTML file index.html Data Documentation
Accessible without login Plain text file LICENSE.txt Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  data  
File Role Description
  Accessible without login Plain text file _main.db.sqlite Data Auxiliary data

  Files folder image Files  /  examples  
File Role Description
Files folder imageassets (2 files)
  Accessible without login Plain text file form.php Aux. Example script
  Accessible without login Plain text file output.php Aux. Example script

  Files folder image Files  /  examples  /  assets  
File Role Description
  Accessible without login Plain text file custom.css Data Auxiliary data
  Accessible without login Image file et.png Photo Photograph

  Files folder image Files  /  src  
File Role Description
Files folder imageimages (1 file)
  Plain text file blank.php Class Class source

  Files folder image Files  /  src  /  images  
File Role Description
  Accessible without login Image file blank.gif Output Sample output

 Version Control Unique User Downloads Download Rankings  
 100%
Total:513
This week:1
All time:5,463
This week:1,047Up