reset all hits to zero ?

3 years 11 months ago - 3 years 11 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.



  • Posts: 23
  • Karma: 1
  • Thank you received:

  • Gender: Unknown
  • Birthdate: Unknown
  • Last Edit: 3 years 11 months ago by cool410. Reason: typo error

    Please Log in to join the conversation.

    3 years 10 months ago #4038 by bram

    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

    <?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);
    



  • Posts: 1494
  • Karma: 57
  • Thank you received: 247

  • Gender: Unknown
  • Birthdate: Unknown
  • The following user(s) said Thank You: cool410

    Please Log in to join the conversation.

    3 years 10 months ago - 3 years 10 months ago #4040 by cool410

    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



  • Posts: 23
  • Karma: 1
  • Thank you received:

  • Gender: Unknown
  • Birthdate: Unknown
  • Last Edit: 3 years 10 months ago by cool410.

    Please Log in to join the conversation.

    Time to create page: 0.051 seconds
    Powered by Kunena Forum