Support » Plugin: WP-Piwik » idSite on a WP site: doesn't track

  • Resolved edou

    (@edou)


    Hi,

    I’ve got the following problem:
    I’m testing now a website, let’s say http://www.site.com which is still under construction.
    Waiting till it is ready, I hard coded the javascript (with “idSite=1” in the index construction page.

    On another folder of the root is the real (in progress) website using WordPress. Piwik is normally installed in it’s own folder, as well as the plugin.

    In the piwik CMS (outside wordpress cms), I created 3 websites: one for the construction page (idsite=1), one with the in progress folder (www.site.com/progress, with idsite=2) on which WordPress is installed. The last one is a subdomain website with idSite=3

    For some reason that I can’t explain, the only tracking code that works is number 1. Both idSite 2 and 3 never detect a connection

    Is it normal? Is there anything to do about it? Could that have anything to do with the fact that I yet don’t allow robots to refer 2 and 3?

    Thanx for your answers.

    E

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

Viewing 15 replies - 1 through 15 (of 25 total)
  • Plugin Author braekling

    (@braekling)

    Does WP-Piwik add the correct tracking code to site 2?
    Is site 3 a WordPress site running WP-Piwik, too?
    Does WP-Piwik itself work fine and only the tracking code does not work?

    Please consider this support forum is just about the plugin WP-Piwik, not about Piwik itself. If the tracking code added to site 2 is correct, the not-working site 3 doesn’t use WordPress and WP-Piwik itself is working fine, you should ask the Piwik community, see http://www.piwik.org

    edou

    (@edou)

    Hi, thx for your answer.
    I don’t really know how to determine whether wp-piwik or piwik a problem is.
    To give it a try last night, I hard coded in site 3 the same tracking code than site 1 (specifying site3 naturally). And then it records visits.
    What I can see, is that if I tell wp-piwik to use wp_footer(), there is no cookie set to the browser. So it makes sense that no record is registered. Why that part doesn’t work, I don’t know.
    Would that mean that piwik doesn’t work properly?

    You can my post hier: http://wordpress.org/support/topic/tracking-works-only-with-hard-coding?replies=1

    Plugin Author braekling

    (@braekling)

    Please have a look at your site’s source code, copy the tracking code added by WP-Piwik and post it here. Thx.

    edou

    (@edou)

    For site 1 (maindomain):

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <!-- Piwik -->
    <script type="text/javascript">
    var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.kvdb.nu/statistiek/piwik/" : "http://www.kvdb.nu/statistiek/piwik/");
    document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
    </script><script type="text/javascript">
    try {
    var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
    piwikTracker.trackPageView();
    piwikTracker.enableLinkTracking();
    } catch( err ) {}
    </script><noscript><p><img src="http://www.kvdb.nu/statistiek/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
    <!-- End Piwik Tracking Code -->
    
    For site 3 (subdomain):
    <!-- Piwik -->
    <script type="text/javascript">
    var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.kvdb.nu/statistiek/piwik/" : "http://www.kvdb.nu/statistiek/piwik/");
    document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
    </script><script type="text/javascript">
    try {
    var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 3);
    piwikTracker.trackPageView();
    piwikTracker.enableLinkTracking();
    } catch( err ) {}
    </script><noscript><p><img src="http://www.kvdb.nu/statistiek/piwik/piwik.php?idsite=3" style="border:0" alt="" /></p></noscript>
    <!-- End Piwik Tracking Code -->
    
    I just made a try on site 2 (subfolder of maindomain) pasting the code generated by piwik and that wp-piwik could see, but that doesn't work, apparently also not when hard coded:
    
    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
      _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
      _paq.push(["setCookieDomain", "*.kvdb.nu"]);
      _paq.push(["setDomains", ["*.kvdb.nu"]]);
      _paq.push(["trackPageView"]);
      _paq.push(["enableLinkTracking"]);
    
      (function() {
        var u=(("https:" == document.location.protocol) ? "https" : "http") + "://www.kvdb.nu/";
        _paq.push(["setTrackerUrl", u+"piwik.php"]);
        _paq.push(["setSiteId", "2"]);
        var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
        g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <noscript><p><img src="http://www.kvdb.nu/statistiek/piwik/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
    Plugin Author braekling

    (@braekling)

    Did you copy these tracking codes from the WP-Piwik settings page, or did you copy these tracking codes from your sites source codes?

    edou

    (@edou)

    for 1 and 3, I got the code from piwik site directly, and hard coded it.
    for site 2, i got it from piwik interface.
    The one generated in wp-piwik would be the following:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u=(("https:" == document.location.protocol) ? "https" : "http") + "://2a01:7c8:eb:0:95:170:70:70/statistiek/piwik//";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', 2]);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
        g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
      })();
    
    </script>
    <noscript><p><img src="http://2a01:7c8:eb:0:95:170:70:70/statistiek/piwik/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
    <!-- End Piwik Code -->
    Plugin Author braekling

    (@braekling)

    See http://wordpress.org/support/topic/tracking-code-has-bare-ipv6-address?replies=5

    If the linked thread won’t help: Please copy the tracking code from your sites source code – not the code shown by Piwik or WP-Piwik.

    edou

    (@edou)

    I’m going to have a look to the thread. I’ll let you know.

    The last code generated by wp-piwik doesn’t work when hard coded.
    when i activate the use of wp_footer(), the source of the page shows the following one:

    [ Moderator Note: Really please post code or markup snippets between backticks or use the code button. ]

    <!-- *** WP-Piwik - see http://www.braekling.de/wp-piwik-wpmu-piwik-wordpress/ -->
    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u=(("https:" == document.location.protocol) ? "https" : "http") + "://2a01:7c8:eb:0:95:170:70:70/statistiek/piwik//";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', 2]);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
        g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
      })();
    
    </script>
    <noscript><p><img src="http://2a01:7c8:eb:0:95:170:70:70/statistiek/piwik/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
    <!-- End Piwik Code -->
    edou

    (@edou)

    I’ve had a look to the post.
    So far, I noticed that my trusted hostanem was http://www.kvdb.nu. Should it be something else regarding the fact that the piwik folder is stored in a subfolder?
    I gave it a try by changing it to http://www.kvdb.nu/thepath, and within no time I had a bunch of error messages.

    Plugin Author braekling

    (@braekling)

    Did you try to disable the “trusted hostname” feature? At least to know if your issue is caused by this?

    edou

    (@edou)

    i just did disable it, and it immediately started to track when I called the site.
    Is there anything else to do to solve that problem?

    Plugin Author braekling

    (@braekling)

    WP-Piwik gets the tracking code using the Piwik API. Obviously Piwik delivers a not working tracking code which contains your severs IPv6 instead of your Piwik’s trusted hostname. Usually this issue occurs if your Piwik URL configured in WP-Piwik differs from the trusted hostname configured in Piwik.

    If your Piwik URL configured in WP Piwik equals the trusted hostname, try to call the API manually: http://PIWIK_URL/index.php?module=API&method=SitesManager.getJavascriptTag&idSite=SITE_ID&piwikUrl=&format=xml&token_auth=AUTH_TOKEN

    If Piwik still delivers a tracking code using the IPv6, please ask the Piwik community: http://forum.piwik.org Otherwise post the API response for comparison.

    edou

    (@edou)

    Just to check, I replaced PIWIK_URL by my site url followed by the path to the piwik folder, SITE_ID with 2 and AUTH_TOKEN with the provided by piwik for site 2. Nothing more.

    I got this result, with no ipv6:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <result><!– Piwik –>
    <script type=”text/javascript”>
    var _paq = _paq || [];
    _paq.push([‘trackPageView’]);
    _paq.push([‘enableLinkTracking’]);
    (function() {
    var u=((“https:” == document.location.protocol) ? “https” : “http”) + “://www.kvdb.nu/statistiek/piwik//”;
    _paq.push([‘setTrackerUrl’, u+’piwik.php’]);
    _paq.push([‘setSiteId’, 2]);
    var d=document, g=d.createElement(‘script’), s=d.getElementsByTagName(‘script’)[0]; g.type=’text/javascript’;
    g.defer=true; g.async=true; g.src=u+’piwik.js’; s.parentNode.insertBefore(g,s);
    })();

    </script>
    <noscript><p><img src=”http://www.kvdb.nu/statistiek/piwik/piwik.php?idsite=2″ style=”border:0″ alt=”” /></p></noscript>
    <!– End Piwik Code –>
    </result>

    edou

    (@edou)

    I must specify that the trusted hostname is still disabled

    Plugin Author braekling

    (@braekling)

    You are posting different tracking codes from different sources, from different Piwik versions and using different settings. So it is not possible to compare your codes.

    First: Did you re-enable the trusted domain feature before testing manually? Otherwise your lastly pasted tracking code is not meaningful.

    To get comparable codes:

    1. Choose ONE of your sites. This site should run WordPress and WP-Piwik.
    2. Keep sure to (re-)enable Piwik’s trusted domain feature.
    3. Check & post the tracking code shown at the WP-Piwik settings page.
    4. Check & post the tracking code added to your site’s source code (Note: if you meanwhile updated Piwik & WP-Piwik, the tracking code is added to your sites header).
    5. Check & post the tracking code delivered by a manually API call using the same settings as before.

    Please follow the moderators note to post your tracking codes between backticks or by using the code button.

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘idSite on a WP site: doesn't track’ is closed to new replies.