Increment Counter

5 posts by 4 authors in: Forums > CMS Builder
Last Post: June 9, 2012   (RSS)

By design9 - June 6, 2012

I have the php incrementCounterField code on a page to count the number of hits a picture is been voted on. However, the coding is counting the page views instead of when people click on the vote button. Is there a way to have it only count the hit when the viewer actually clicks on the vote button? The issue is that people may want to just see the detail page photo and not vote on that photo.

Thanks!
April

I have attached my details page as well in case you need to look at it.
Attachments:

traveldetails.php 26K

Re: [gkornbluth] Increment Counter

By design9 - June 8, 2012

This really doesn't work for me because I am using an image. So, I think I still need to figure out a way to do this. Example, I have a facebook icon which is an image and I want to be able to count how many times users click on the icon to visit the facebook page instead of just the page view. the user may go to the page but not click on the icon so counting the page view is misleading.

Thanks!
April

Re: [design9] Increment Counter

By Jason - June 8, 2012

Hi April,

There are a couple of approaches you could take here. The easiest I can think of is having your facebook icon click refresh your page with an extra variable in the URL. On your page, you can detect this variable, and then increment your counter before redirecting them to the facebook page. The user shouldn't notice a difference at all.

Hope this helps,
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Increment Counter

By Toledoh - June 9, 2012

If you use Google Analytics, you can easily achieve this with their _trackPageview() JavaScript.

ie.

<a href="http://www.facebook.com" onClick="javascript: pageTracker._trackPageview("/links/facebook.com");">

If you're inserting links via CMSB, just put the link as the href and as the trackPageview.
Cheers,

Tim (toledoh.com.au)