• Resolved Mark

    (@codeispoetry)


    I installed Matomo on a WP multisite installation with two websites. On the root URL it works; on the site that is in a subfolder, it doesn’t (no data is shown under reporting, even though I can see the tracker code being loaded). The site where it doesn’t work is this one; I have created a Matomo Superuser account with the [email protected] email so that you can have a peek.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Thomas

    (@tsteur)

    Hi @codeispoetry

    thanks for this and sorry about the problem. I can definitely reproduce this issue and it seems to be trying to load the JS tracker file from the wrong path. Do you know if there were any wp-config.php changes to change the directories for multi sites or if there were maybe any other changes? I see for example blogs.dir being used. In case you know which configurations were made for multisites, then it would help me reproduce it better.

    Plugin Author Thomas

    (@tsteur)

    @codeispoetry any chance you are familiar with PHP or patching files in your WordPress? In case you are, could you apply these changes as shown in https://github.com/matomo-org/wp-matomo/commit/05f95656e0e4fcec683929b24597889400bd6f13 to the file in wp-content/plugins/matomo/classes/WpMatomo/Admin/SystemReport.php?

    This would help me better understand the problem.

    Thread Starter Mark

    (@codeispoetry)

    Unfortunately I have admin access to WP but not SFTP access to the file system in this install, so I can’t answer the wp-config question. But patching was possible through the WP plugin editor, so that’s now done.

    Update: I can view the file though. This is the most relevant code:

    
    define('SUBDOMAIN_INSTALL', false);
    $base = '/';
    

    (snip)

    
    // fix file upload location?
    define( 'UPLOADBLOGSDIR', 'wp-content/uploads/sites' );
    
    function stupid_ms_files_rewriting() {
            $url = '/wp-content/uploads/sites/' . get_current_blog_id();
            define( 'BLOGUPLOADDIR', $url );
    }
    add_action('init','stupid_ms_files_rewriting');
    

    I’m including the latter part since you mentioned the upload dir. I’m not responsible for the server but some sysadmin apparently had to add a function for a feature they didn’t like? ??

    • This reply was modified 4 years ago by Mark.
    Thread Starter Mark

    (@codeispoetry)

    Sorry for mucking about, but I found I do have access so (1) I’ve commented out those lines above in wp-config.php, and (2) added a proper ms-files statement to .htaccess as specified in the Network Setup dialog. This does solve one problem I had on the blog (uploaded images wouldn’t display) so I’ll keep it this way (bringing it closer to a vanilla multisite setup).

    But I can still see that the matomo.js file is being sought in a subfolder (where it doesn’t reside) instead of where you’d expect it, and I don’t know where that URL is generated.

    Plugin Author Thomas

    (@tsteur)

    Thanks for this @codeispoetry

    I’m not 100% sure but it seems loading the JS file and tracking works now correctly?

    Thread Starter Mark

    (@codeispoetry)

    Yes! Thank you, I was not aware of those legacy multisite settings and your pointer to wp-config was right on the money.

    Plugin Author Thomas

    (@tsteur)

    Great to hear @codeispoetry glad it works now

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Multisite install: one site works, the other not’ is closed to new replies.