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: [design9] Increment Counter

By gkornbluth - June 7, 2012

Hi April,

Take a look at this post.

http://www.interactivetools.com/forum/gforum.cgi?post=92168

Hope it gives you some ideas,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

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)