News:

Wondering if this will always be free?  See why free is better.

Main Menu

Click counter on HTML Image?

Started by OzzyMozzy, April 27, 2012, 09:27:24 PM

Previous topic - Next topic

OzzyMozzy

Hi, I'm using SMF 2.0.2 with SimplePortal. I have a left block Custom HTML that is an image members can click on to take them to a web page.

I want to be able to count how often the image is clicked on, can this be done? I would also like it if only i could see the count.

Matthew K.

It'd have to be a custom PHP block, and you'd have to integrate it with $modSettings, or a database table of some sort.

ApplianceJunk

One way would be to use https://bitly.com/.

Create a shorten link with https://bitly.com/ and use it in place of the regular link.
https://bitly.com/ will track the stats for you.

TheListener

Hi OzzyMozzy

As this is a portal themed question you should ask in the mods support topic or on www.simpleportal.net

I myself am not sure if or how this could be done however I know someone at the above link will be in a better position to help.

ApplianceJunk


OzzyMozzy

Thanks for that link, i signed up to have a look. It talks about shortening the link but how does it work to track the clicks on my image?

ApplianceJunk

A image link would look something like this...

<a href="http://website.com"><img src="http://YourImageURL.com"></a>

You would use https://bitly.com/ to create a new shorten link for http://yourimageurl.com

Then replace http://yourimageurl.com with the new shorten link bitly.com gives you.

Go back to bitly.com to view the clicks and other stats on the new shorten link you are using.

OzzyMozzy

Ah i get it now and just tried it out, thanks heaps for that.

Will it count it if the same link was somewhere else? or does it only count it from my web site?

ApplianceJunk

Quote from: OzzyMozzy on April 27, 2012, 10:09:41 PM
Ah i get it now and just tried it out, thanks heaps for that.

Will it count it if the same link was somewhere else? or does it only count it from my web site?

I believe it will count the shorten link it creates from anyplace it's clicked on.

I use them in emails and they get tracked.

OzzyMozzy

So it will only click the shorten link and not count the long link that will be on other web sites?

ApplianceJunk

It only tracks the new shorten link you created.

OzzyMozzy

Sweet, thought so i just wanted to confirm, im new to all this. Thanks heaps again it's working and it's perfect...

ApplianceJunk

I'm no expert with it, so this may help answer a lot of your questions better then I can.

https://bitly.com/pages/help

ApplianceJunk

Quote from: OzzyMozzy on April 27, 2012, 10:42:12 PM
Sweet, thought so i just wanted to confirm, im new to all this. Thanks heaps again it's working and it's perfect...

Glad I could help. :)

OzzyMozzy

I have noticed the click count on bitly is way over the top and found that the links are getting hit by bots. I was watching them and each one of the 4 i have each got a click counted all at the same time.

So yes this bitly works but it gives a false reading in my case as i don't want to count bots just real clicks..

Colin

Yes, that is going to require some PHP if you want to filter out bots and some you won't be able to.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

OzzyMozzy

I have now tried a couple that replace my image link with their own URL to count which is fine but they don't filter bots.

Isn't there any programs out there that is simple and easy to use that will do the job?

MrPhil

If you want guests' clicks to count too, and not just logged-in members, you're going to have to look at the user agent ($_SERVER['HTTP_USER_AGENT']) and weed out anything that sounds like a bot or not a known browser. This could be after the click, or simply displaying an image instead of a link. Keep in mind that it's not foolproof, as some bots pretend to be well-known browsers (to prevent just this sort of action). If you want to ignore guests (as well as bots), you could add code to only display the link for members.

Advertisement: