When using SystemSetting in a custom Plugin, i can’t get the value in hook newVisitorInformation, the following error occurs:
“CoreAdminHome_PluginSettingChangeNotAllowed”
following code:
public function getListHooksRegistered()
{
return array(
'Tracker.newVisitorInformation' => 'logCustomData',
);
}
public function logCustomData(array &$visitorInfo)
{
if (empty($visitorInfo['location_latitude']) || empty($visitorInfo['location_longitude'])) {
return;
}
$settings = new Settings('Weather');
$aid = $settings->aid->getValue();
if (empty($aid)) {
return;
}
$api_url = EXTERNAL_API_URL . '?aid=' $aid;
$response = \Piwik\Http::sendHttpRequest($api_url, 6);
$response = json_decode($response);
$visitorInfo['custom_data'] = $response['custom_data']';
}
Additonally i need to query an external api to get custom data, any better way for doing this?
Regards