ich habe mir gestern einen Blog mit WordPress erstellt und möchte nun mit Piwik die Benutzerzahlen auswerten. Irgendwie funktioniert das aber nicht. Ich habe WordPress direkt unter soko-gc.bplaced.net/piwik Für Piwik und Wordpress gibt es jeweils eine eigene Datenbank. Die WordPress Version ist 3.8, die Piwik Version 2.0.2 Wie binde ich Piwik in WordPress ein? Das Plugin funktioniert nämlich nicht.
Im Admin-Panel von Piwik findest du in den Einstellungen den Tracking Code (der Menüpunkt heißt direkt so), den du in die Index-Datei deines Templates einfügen musst. Steht alles dabei, wie du vorgehen musst.
ich weiss zwar nicht wie man die Index-Datei bearbeitet, habe aber aber unter dem angegebenen Menüpunkt die Option “Tracking mit Hilfe eines Bildes” gefunden und den HTML-Code als Widget in den Blog eingefügt. Über “Tracking mit JavaScript” habe ich zwar vermutlich mehr Möglichkeiten, aber fürs erste geht es auch mit dem Bild… Vielleicht kriege ich es aber auch noch über JavaScript hin…
Die Index-Datei kannst du beispielsweise mit dem Windows-Editor bearbeiten. Übrigens ist es immer hilfreich, sich ein wenig mit der Software zu beschäftigen, die man verwenden möchte
ich mache zwar alles mit dem Smartphone aber hier habe ich jetzt auch eine App die .php bearbeiten kann. Wo muss der Code in die Index Datei denn rein? In der Index-Datei steht:
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
in der Index Datei gibt es aber keinen Body-Tag… Wohl aber in der Footer, soll ich den Code jetzt in die Footer tun? Ich meine, irgendwo gelesen zu haben, dass das der richtige Platz ist…
Code Index:
[code] <?php
/**
The main template file
This is the most generic template file in a WordPress theme and one
of the two required files for a theme (the other being style.css).
It is used to display a page when nothing more specific matches a query,
e.g., it puts together the home page when no home.php file exists.
<?php
if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
// Include the featured content template.
get_template_part( 'featured-content' );
}
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
endwhile;
// Previous/next post navigation.
twentyfourteen_paging_nav();
else :
// If no content, include the "No posts found" template.
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
<?php
get_sidebar();
get_footer();[/code]
Code Footer:
[code] <?php
/**
* The template for displaying the footer
*
* Contains footer content and the closing of the #main and #page div elements.
*
* @package WordPress
* @subpackage Twenty_Fourteen
* @since Twenty Fourteen 1.0
*/
?>
In dem Fall dann ja. Ich wußte jetzt nicht, wie die WP-Themes aufgebaut sind. Ist ja von Software zu Software wieder unterschiedlich. Mußt dann nur dran denken, wenn du das Template wechselst, entsprechend auch den Piwik-Code mit einzubauen.