Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration and site IDs #25

Closed
TRILOS opened this issue Jul 29, 2020 · 5 comments
Closed

Migration and site IDs #25

TRILOS opened this issue Jul 29, 2020 · 5 comments

Comments

@TRILOS
Copy link

TRILOS commented Jul 29, 2020

When installing the Matomo plugin for WordPress, a record is being created for the site in wp_matomo_site table with idsite=1.
Using Migration plugin in Matomo 3.14.0, the data from a site with id 2 is being imported into the WordPress datababase, but a second site in the target database with idsite=2 is being created and all data is referring to that ID 2.
The Matomo plugin for WordPress seems to expect a site with ID 1 and we can switch to site ID 2 in the Dashboard, but this is not nice to do this every time. And the plugin seems no to be able to handle only 1 site in wp_matomo_site table with any other ID than 1 (it leads to a fatal error).
So it seems to be necessary to provide a target-site-id paramater for the console migration command.
And I like to know whether I can change the cross linking reference from the default site to the data in the WordPress database to prevent the user from changing the site in the Dashboary every time.

@tsteur
Copy link
Member

tsteur commented Jul 30, 2020

Hi @TRILOS

I just realise we're actually not really supporting this as mentioned in https://matomo.org/faq/wordpress/how-do-i-migrate-all-my-data-from-matomo-on-premise-to-matomo-for-wordpress/ but we should have made this more clear in the readme etc.

I've documented some background in #26 and also provided a query to link the new site. This query should do the trick:

update wp_options set option_value = 2 where option_name = "matomo-site-id-1"

@tsteur tsteur closed this as completed Jul 30, 2020
@TRILOS
Copy link
Author

TRILOS commented Jul 30, 2020

Hi @tsteur , as I understood, the Migration plugin is dedicated and officially recommended to migrate also to Matomo for WP. And this scenario here shows the conditions: WP Plugin installation creates site ID. So the Migration solution should be aware of different source and target site IDs.
Anyway, the SQL statement uses an option with does not exist in wp_options or wp_matomo_option. The question is, where the site ID setting for Matomo for WP plugin is...

@tsteur
Copy link
Member

tsteur commented Jul 30, 2020

The option should be there @TRILOS any chance you are using WP Multisite mode?

@TRILOS
Copy link
Author

TRILOS commented Jul 31, 2020

@tsteur , no, the WP site in this case is no Multisite. I have searched for applicable columns and values and did not find anything.

@tsteur
Copy link
Member

tsteur commented Aug 3, 2020

@TRILOS I checked again and the mapping should be stored in the options table if you are not using MultiSite.

image

If Multisite was enabled, it would store it likely in a wp_sitemeta table but this table should not even exist if you aren't using multisite.

Matomo isn't looking somewhere else for the mapped idSite. If it's not stored there, technically the plugin should not even really work for you. Is there any chance you can check again? And if it's not there can you maybe post your system report?

The report should be anonymised but you could also email us at wordpress at matomo.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants