matomo-org / plugin-GoogleAnalyticsImporter

Google Analytics to Matomo importer
24 stars 14 forks source link

Better support for importing on shared hosting servers #54

Open HorstGassner opened 4 years ago

HorstGassner commented 4 years ago

Hi!

If I open the settings I get the following error:

Fehler [GoogleAnalyticsImporter] Required Executables (php) [GoogleAnalyticsImporter] Required Executables (nohup)

I'm using the latest version of Matomo and the PlugIn (1.2.1)

diosmosis commented 4 years ago

For now, the CLI php and nohup executables have to be available on your server for the importer to run. These errors are reporting that Matomo cannot find them. Are they in actuality available?

HorstGassner commented 4 years ago

Thank you for your fast response!

Maybe a dumb question - but where could I find these files? What I can find is CliPhp.php in the Matomo /core/CliMulti/ directory.

I've installed Matomo in it's own subdomain. These should not be a problem, should it?

diosmosis commented 4 years ago

Those (php & nohup) are actually executables that would be found on your server. Your host (if you have one) may have disabled their use in some way. The plugin currently uses them to do the importing in the background. It's something you'd have to talk to your host about, or perhaps there is some setting that needs to be set in cpanel, otherwise importing won't currently be possible.

That said, I've recently thought of a way around that since there are many users on shared hosting that seem interested in importing their GA data. Unfortunately I won't have time to work on it for a week or two, but it will be available in version 1.3.0.

EDIT: Just in case I didn't answer your question, they would be in one of your server's bin folders. If you can run commands on the server via ssh access, you could run which php or which nohup to find them.

HorstGassner commented 4 years ago

Importing data is one of the things that are very important to many of my colleagues (I am a blogger and the EU GDPR is a painful problem for many of us). Most of us want to get rid of GA, but we don't want to lose historical data. And yes - many of us use shared hosting (because it's cheaper).

My current provider package does not allow SSH access. An upgrade would not be that expensive, but at the moment I have no chance of using SSH. Maybe I'll upgrade.

It would be great if the plugin would work without SSH in the future and I think there are some people out there who would love that :-).

diosmosis commented 4 years ago

@HorstGassner I wouldn't purchase ssh, having ssh access wouldn't make the plugin work for you, it would just allow you to check/debug some things. I might ask the host specifically "Is it possible to make the 'php' and 'nohup' executables available on my server?" and "How long will a script when run via shell_exec("php ...") be allowed to run before it is terminated (if it is terminated)?". These are the main problems that occur with shared hosting (the executables being missing or the import process being cut off by the host because it takes a long time), and if the host can fix them then you won't have to pay at all.

However, it's pretty likely the host won't be able to make any changes, but as I said, I have solution to the problem and it will be available in a week or two.

seybsen commented 4 years ago

A config option to set paths to php and nohup would be nice for hosts which have multiple php versions installed (e.g. Plesk)

errotu commented 4 years ago

First of all: Thanks a lot for your great work! Unfortunately, I'm also affected by the limitations of my hoster. Are there any news on the implementation of an importing method without nohup?

diosmosis commented 4 years ago

@errotu unfortunately it's not a high priority at the moment, matomo 4 is the main focus.

Note: you can import from the CLI directly using the googleanalyticsimporter:import-reports command (the user docs have more info on this and some possibilities for bypassing shared hosting limitations). However you may run into other limits/blocks placed by the hoster.

diosmosis commented 3 years ago

In case anyone wants to avoid using nohup, it's possible w/ the latest version to use the GoogleAnalyticsImporter.useNohup DI setting. This would require adding the setting to your matomo/config/config.php file (creating it if it's not there):

<?php

return [
    'GoogleAnalyticsImporter.useNohup' => false,
];
dathwa commented 3 years ago

Can someone please explain where exactly i may disable nohup. Matomo V4.5. There is no config/config.php file. There is config.ini.php tried GoogleAnalyticsImporter['useNohup] = false but it breaks site. Thanks.

In case anyone wants to avoid using nohup, it's possible w/ the latest version to use the GoogleAnalyticsImporter.useNohup DI setting. This would require adding the setting to your matomo/config/config.php file (creating it if it's not there):

<?php

return [
    'GoogleAnalyticsImporter.useNohup' => false,
];
diosmosis commented 3 years ago

@dathwa config/config.php is a file you create the first time you need it. Matomo doesn't break if it's not there.

bastians commented 1 year ago

@diosmosis My hoster does not allow nohup for PHP, therefore I would like to use the setting. I created the config.php file and added the code you posted. Should the hint in the system check of Matomo be gone or does it still show up?

diosmosis commented 1 year ago

@bastians it should still show up at present. The diagnostic code doesn't take into account the dependency injection override in config/config.php.