Skip to main content

reset all hits to zero ?

More
8 years 4 months ago - 8 years 4 months ago #4037 by cool410
Hi Bran

I need away to reset all my hits every month back to zero.
I have a feeling that Affiliate windows is missing some of my hits
so I want to reset on the same day as they start the new month
can this be done easily as I seem at the moment only to be able
to reset one at a time and I have over 10,000 items.

I did a search on this subject and it seem to be not mentioned.
Last edit: 8 years 4 months ago by cool410. Reason: typo error

Please Log in to join the conversation.

More
8 years 4 months ago #4038 by redactie
Replied by redactie on topic reset all hits to zero ?
Sorry, was sure I did write a reply before the weekend but somewhere that one got lost.

The component does not have a reset-hits function. I wrote a small script to do the job.

Counting hits is a bit tricky in the component, hits are linked to individual items so if a item is removed from the database the hits are also. And you might get clicks from bots.

A more reliable method is using (google)analytics to count the click outs. Either using a click trigger on your affiliate links, using a clickout page or using the google measurement protocol

Code:
<?php #goes into the root of your site, next to the configuration.php # file name for example reset-all.php #requires a recent version of the component ( for mysqli.php) include('configuration.php'); include('administrator/components/com_datafeeds/cron/mysqli.php'); $config=new JConfig; $db_host= $config->host; $db_host= $config->host; $db_user= $config->user; $db_password=$config->password; $db_database=$config->db; $fromname=$config->fromname; $mailsite=$config->mailfrom; $mailfrom="$fromname <$mailsite>"; $db_table= $config->dbprefix .'dataitems'; $db_feeds= $config->dbprefix .'datafeeds'; db_connect($db_host, $db_user, $db_password,$db_database); $q="UPDATE `$db_table` set hits=0 "; echo "Hits reset - " . db_query($q);
The following user(s) said Thank You: cool410

Please Log in to join the conversation.

More
8 years 4 months ago - 8 years 4 months ago #4040 by cool410
Replied by cool410 on topic reset all hits to zero ?
I Tried it nothing happened just got a blank web page .
was I meant to do something else I made a new file and called it zero-hits.php
and put it in the root as per instructed
I assume to use it I just call this PHP and go with the flow.

Thanks, I didn’t mind the delay it was not a life threatening problem.
and I hope you enjoyed the weekend . which is far more important Family etc.

Thanks
Last edit: 8 years 4 months ago by cool410.

Please Log in to join the conversation.

Time to create page: 0.570 seconds