Transfer Data from one siteId to another SiteId

Hi there,

is it possible to transfer data from period XY from one siteId to another siteId?

Hi,

Unfortunatly it is only possible to copy a complete siteId to another newly created one using Migration - Matomo Plugins Marketplace

1 Like

that’s annoying :slight_smile: Are there no possibilities to somehow export a period and then import it again?

Maybe get it directly from the database (replace id etc or whatever?)

Not directly.
Maybe the following work around will work:

  • set up a new Matomo with the same version.
  • use the Migration - Matomo Plugins Marketplace plugin to copy data from the siteID into the new Matomo
  • remove the data you don’t need via the General settings > Delete old visitor logs and reports or do it directly in the database
  • and then set it up the other way around. From your temporary platform to the production platform.

I hope this will work for you.
Regards,
Peter

@PeterM

Thanks, but tis doesn´t Work:

SELECT log_visit, log_link_visit_action, log_conversion, log_conversion_item
    FROM matomo_286_STlog_visit
    LEFT JOIN matomo_286_STlog_link_visit_action ON log_visit.idvisit = log_link_visit_action.idvisit
    LEFT JOIN matomo_286_STlog_action ON log_action.idaction = log_link_visit_action.idaction_url
    LEFT JOIN matomo_286_STlog_conversion ON log_visit.idvisit = log_conversion.idvisit
    LEFT JOIN matomo_286_STlog_conversion_item ON log_visit.idvisit = log_conversion_item.idvisit
    WHERE log_visit.idsite = 4
AND visit_last_action_time >= '2016-02-19' 
AND visit_last_action_time <= '2016-02-29';

#1054 - Unknown Tabellenfeld 'log_visit' in field list

@Miches

Keep in mind that your tables might have a matomo_ or piwik_ prefix if you set that up when first installing. So your table might be matomo_log_visit or piwik_log_visit.

1 Like

@Lukas

I set the prefix, but the field doesnt´exist:

SELECT log_visit, log_link_visit_action, log_conversion, log_conversion_item   
FROM matomo_286_STlog_visit

Taken from:
https://matomo.org/faq/how-to/faq_20184/

   DELETE log_visit, log_link_visit_action, log_conversion, log_conversion_item
    FROM log_visit
    LEFT JOIN log_link_visit_action ON log_visit.idvisit = log_link_visit_action.idvisit
    LEFT JOIN log_action ON log_action.idaction = log_link_visit_action.idaction_url
    LEFT JOIN log_conversion ON log_visit.idvisit = log_conversion.idvisit
    LEFT JOIN log_conversion_item ON log_visit.idvisit = log_conversion_item.idvisit
    WHERE log_visit.idsite = X;

Afaik, the DELETE Statement can’t have other tables between DELETE and FROM, just some more attributes like [LOW_PRIORITY] [QUICK] [IGNORE].

EDIT: Yes, it can (multi table delete), so the problem is somewhere else.

The SELECT statement from above won’t work, since after the select, you must specify the columns to be included in the query response, not tables. That only can be handled by DELETE (multi table). What error do you get with the DELETE Statement?