Problem counting clicks

Hi you wrote a post on counting clicks I followed, I tried your method being: on click, using ajax to call php and then used my update script to +1 in the user row under visitor page views. Your process works, thanks, but I have an issue and there are no more posts in that thread I hope you can help? So I did the above - however, it is counting the logged in user page views. So I have it back to front. it seems. I called this activity which is working as shows a users activity on the site, but I am still trying to reach my goal to show, how many visitors (not logged in) have clicked a link. So I have add 1 on page load (views) and add 1 on click (clicks) but all working from a logged in user perspective - scratching my head a bit on this I am hoping you have seen or done the same thing before and have the easy answer? ps and not a sales pitch but you can see it on will see I called it activity…lol…but as mentioned - I am still trying to make your (working) process work to +1 in user row but it needs to add +1 for an external web visitor who clicking the ling on their page…so to show - how many clicks each user has received on their page. Can you shed some light? would appreciate it. And happy to contribute from my lessons building the site and app, shot!

I am not quite sure what post you are following, but in the script that is updating the click counts, you just need to check if the user is logged in. How this is done differs on the platform. For instance if this a wordpress site you could use something like is_user_logged_in() to check if the person running the script is logged in. If they are, you would ignore the updating of the count. If they are not, then you update the count.

If the site is just straight PHP backend, then you need a way to check if a user is currently logged in. This might be to check if they provided a cookie or have a session started that contains a “logged in” value. Either way, test if they are logged in and only then would you update the count. :slight_smile:

It might help others to help you if you post a link to the article, @clickfaces.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.