Support » Plugin: Connect Matomo (WP-Matomo, WP-Piwik) » [german] [API] Besucher letzte 7 Tage in content.php

  • Resolved Thomas Kujawa

    (@thomas-kujawa)


    Guten Tag.

    Da ich bei meiner Suche bisher nicht fündig geworden bin, frage ich hier nach Unterstützung.

    Wir sind mit unserer Seite zu WP3.8 umgezogen. In unserem bisherigen CMS haben wir mit einem PHP-Code und der API unter dem Beitrag angezeigt, wieviele Besucher die letzten 7 Tage den Beitrag angesehen haben.

    {php}       $slash = $this->get_template_vars('Slash');
                 $urltrenner = $this->get_template_vars('Urltrenner');
                 $urlheader = $this->get_template_vars('UrlHeader');
                 $url = "_domain_".$slash.$urltrenner.$urlheader;
                 $result = file_get_contents("_piwik-pfad-mit-domain_/index.php?module=API&method=VisitsSummary.getVisits&idSite=1&period=range&date=last7&format=php&token_auth=_token_&segment=pageUrl=@".urlencode($urlheader));
                 $Besucher = unserialize($result);
                 if ($Besucher > 0) echo "- ".$Besucher." Besucher letzte 7 Tage";{/php}

    Da ich neu bei WP bin, habe ich versucht, dies über den Shortcode in die content.php zu integrieren. Aber ich scheiterte – er hab nur den ‘Quellcode’ aus.

    Ein Hinweis, wie ich da starten muss, wäre sehr hilfreich. Eine Umsetzung natürlich noch besser.

    http://wordpress.org/plugins/wp-piwik/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m sorry but these are English language forums, so please use English or provide an English translation. Alternatively, use a WP support forum in your language.

    Thread Starter Thomas Kujawa

    (@thomas-kujawa)

    o.k.

    How to integrate the api from piwik into the content.php ?

    the shortcode doesn’t work.

    In our former cms we used the code in the former post. (it was with smarty)

    Thomas

    Thread Starter Thomas Kujawa

    (@thomas-kujawa)

    the performance is bad, put it works. any ideas to change the load time.

    <?php $urlheader = get_permalink();
          $result = file_get_contents('http://www.familienfreun.de/piwik/index.php?module=API&method=VisitsSummary.getVisits&idSite=1&period=range&date=last7&format=php&token_auth=_token_&segment=pageUrl=@'.urlencode($urlheader));
          $Besucher = unserialize($result);
          if ($Besucher > 0) :
             ?>
             <span class="glyphicon glyphicon-stats"></span>
             <?php echo $Besucher; ?>
             <span>Besucher letzte 7 Tage
          <?php endif; ?>
    Plugin Author braekling

    (@braekling)

    This is the WP-Piwik support forum. For support regarding Piwik itself (and its API) habe a look at the Piwik community (http://forum.piwik.org), where you also find a Germany forum.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[german] [API] Besucher letzte 7 Tage in content.php’ is closed to new replies.