Determine Click-thru Percentage With PHP
I am currently working on a small sponsorship application(PHP/MySql) for my personal blog, and am almost finish, but I am stuck on how to calculate the click-thru rate of my sponsors campaig开发者_运维百科ns.
I was always terrible with working out percentages, so any practical help would be appreciated. The data is stored in the DB as simple numbers.. So as expected, when a page refreshes, or a sponsors ad is clicked, the data updates with an incrementation of 1.
So using these values...say $clicks and $impressions, how would I determine the click-thru rate? What would be the sum I would use to calculate? An example function would really be appreciated.
Kind Regards, Lea
What you're after is the percentage of $impressions
that leads to $clicks
. The ratio is found by calculating $clicks/$impressions
, and then you can multiply by 100 to see the percentage.
As an example, if there are 100 impressions and 1 click, the ratio will be 1/100 = 0.01
, and the percentage will be 0.01 * 100 = 1%
.
精彩评论