I was wondering if there is any way of tracking the number of times that a .jpg is displayed?

The way that it is being used is that it is being displayed in an advertising campaign, and when someone opens the email, the .jpg is displayed, and I would like some way from my end to track that. I get tracking numbers from the advertiser, but don't always trust what I am told.

I know I could track it if a page was being visited easy enough, but that isn't how it works...

When they click on the graphic in the email it passes through a page that updates a DB table tracking the Click Throughs, but I would like both numbers.

Any suggestions?

Recommended Answers

All 8 Replies

Member Avatar for LastMitch

The way that it is being used is that it is being displayed in an advertising campaign, and when someone opens the email, the .jpg is displayed, and I would like some way from my end to track that. I get tracking numbers from the advertiser, but don't always trust what I am told.

It's a bit difference. When someone open the email, then you will receive the email noiftying you that it is open if you enable the email status. Most email account has a checkbox to let you used that feature.

But it has nothing to do with the image(s) being click. It's really depend if that person click the image(s). If that person doesn't click it then it won't be recorded. If that person click that image(s) and it goes to that specific page that has that image(s) then yes you can track it by using google analytics. You just put the google analytics code on that page that has image(s) on it.

When they click on the graphic in the email it passes through a page that updates a DB table tracking the Click Throughs, but I would like both numbers.

You need to used something like this (both links has code-snippets which you can used and modify to suited your own code):

http://thatsmith.com/2008/11/how-to-make-tracking-images-with-php

http://webcheatsheet.com/PHP/dynamic_image_generation.php

A simple method, for example, is this:

<?php
    # declare variables to register
    $path = '/images/';
    $image = $_GET['image'];
    $ip = $_SERVER['REMOTE_ADDR'];
    $browser = $_SERVER['HTTP_USER_AGENT'];
    $date = date('Y-m-d G:i:s');
    $cid = $GET_['campaign_id']; # so you can identify the newsletter
    $ucode = $_GET['user_code']; # so you can identify each user opening the newsletter

    # check if variables contents are true
    if(/* check */) # true
    {
        // database connection . . .

        $q = "insert into newsletter_stats (`ip`,`browser`,`open_date`,`campaign_id`,`user_code`) values('$ip','$browser','$date','$cid','$ucode')";

        # insert data
        mysql_query($q) or die(mysql_error()); # consider using mysqli
    }

    # display the image, this could be a simple image 1x1 or your company logo
    if(file_exists($path.$image))
    {
        header("Content-Type: image/jpeg");
        echo file_get_contents($path.$image); # image to display
    }
    else
    {
        echo 'image not found';
    }
?>

The link to the image should be something like this:

http://localhost/img.php?image=dot.jpg&campaign_id=23&user_code=md5_hash_here

But you can use .htaccess and mod_rewrite to create a link easier to read:

http://localhost/img/md5_hash/23/dot.jpg

Obviously there will be a different md5 hash for each user, so you may have to automate the process. But if you are not interested on checking specific user habits then you need only links to identify the newsletter:

http://localhost/img/23/dot.jpg

And so on...

Downsides about this method: if you have many access there will be a lot of write activity to the database and by consequence to the disk, so you could use a work queue (as beanstalkd or gearman) to perform background inserts, or write them to the memory engine (which will store data in RAM) and then have a process (an event!) moving them to permanent engines like myisam/innodb: http://dev.mysql.com/doc/refman/5.1/en/create-event.html

Thank you both for your responsed, but I guess maybe I wasn't clear enough in my explanation...

The way that it is being used is that it is being displayed in an advertising campaign, and when someone opens the email, the .jpg is displayed, and I would like some way from my end to track that. I get tracking numbers from the advertiser, but don't always trust what I am told.

What I meant by this is that I am paying for a mass mail campaign...
I provide them with the Graphic and the link url
They send out to their email list, and tell me how many out of the 1,000,000 it was mailed to supposedly opened it Then they also tell me how many Clicked on the graphic, which takes them to my website.

I can track how many actually click on it because I direct it to a url that counts that.

But I have no way to know how many saw it.

Here is the issue...
I have a known good ad that when used with one mailer shows on average 1,400 Clicked the Link and they say that 16,000 opened the email Those numbers I can live with, because it generates between 40-60 signups.

BUT, I tried another service that was supposed to send out 4 million. Their stats say that out of that 4 million 796,000 opened the email (which I find hard to believe) and they show a total of 19 Clicks on the link, with zero signups... I'd say there is something wrong with that picture, and I would really like to just see all the stats from my end if at all possible.

Member Avatar for LastMitch

But I have no way to know how many saw it.

When someone open the email, then you will receive the email noiftying you that it is open if you enable the email status on your email account. Most email account has a checkbox to let you used that feature. The purpose of this feature is to keep track email that has been send out and notify you if the email is open. You have to write down the email that is open.

BUT, I tried another service that was supposed to send out 4 million. Their stats say that out of that 4 million 796,000 opened the email (which I find hard to believe) and they show a total of 19 Clicks on the link, with zero signups... I'd say there is something wrong with that picture, and I would really like to just see all the stats from my end if at all possible.

This is more related to the Internet Marking Section. It has nothing to do with the code that cereal and I provided. That is more related to a software. You are asking members if there is a better software than the one you have.

It has nothing to do with the code that cereal and I provided.

Sorry LM but the code I wrote is exactly to check who and when reads the newsletters (when the images are enabled in the HTML version). The key is to use unique image links for each recipient, or at least different links for each campaign. This can be done easily if the used platform provides the correct instruments.

For example: MailChimp provides an API which allows to submit contents from a personal interface, so the image links can be autogenerated by a script, otherwise (more easier) there is the chance to create unique links to a remote image by using their Merge Tags mechanism, and include them in the template, something like:

http://my_webserver.tld/img/*|CAMPAIGN_UID|*/*|EMAIL|*/dot.jpg

will become:

http://my_webserver.tld/img/23/abc@cba.com/dot.jpg

And when a user opens the HTML version of the newsletter, will perform a GET connection to our server and load the script that renders the remote image, throught that you can solve the problem. I hope this is useful, I don't know which service is used by the OP, but this it may give an hint.

For more information check this: http://kb.mailchimp.com/article/can-i-create-a-different-link-for-each-recipient-using-the-merge-tags

Bye! :)

Member Avatar for LastMitch

Sorry LM but the code I wrote is exactly to check who and when reads the newsletters (when the images are enabled in the HTML version). The key is to use unique image links for each recipient, or at least different links for each campaign. This can be done easily if the used platform provides the correct instruments.

cereal the code you provided is correct. I never said it was incorrect. I didn't understand his question so the code I provided was irrelevant.

What showman13 really want is to keep track on the mass mail campaign that he is paying for.

He wants to compare the numbers from his database to the numbers of the mass mail campaign provided him.

He wants to know the actual numbers of open emails and clicks and compare to mass mail campaign numbers.

If the numbers doesn't add up showman13 wants to get his money back (his refund).

Thank you again for your responsed...

I don't expect to get my money back (refund), but I will sort out the truthful operators from the frauds and share that information with those that would like to know, beginning with my 3200+ members...

Don't want to see them wasting their money on systems that aren't factual.

Thanks again...
Douglas

commented: You are a good person! +11
Member Avatar for LastMitch

I don't expect to get my money back (refund), but I will sort out the truthful operators from the frauds and share that information with those that would like to know, beginning with my 3200+ members...

I'm sorry to heard that. But I hope you can find another option and I hope things will work out for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.