matomo content tracking not coming through to dashboard - matomo
I am not able to get content tracking working in Matomo 4.4.1.
Event tracking works fine, now I want to implement content tracking so data shows up in Behaviour > Contents.
I followed the manual and enabled content tracking so the current Javascript looks like this:
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
_paq.push(["trackAllContentImpressions"]);
(function() {
var u="//matomo-test.nfshost.com/matomo/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '3']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
I enhanced various elements on my page with data-attributes such as data-track-content and data-content-name.
When I go to the Chrome Dev console and type in _paq.push([‘logAllContentBlocksOnPage’]) I get an array of all the elements so this is also looking good.
Then, when accessing the website and clicking on a button or link that has the data-track-content attribute a request in the Google Dev Tools Network tab is fired just fine. The code snippeet below is is the debug content of such a request.
However, when I go to Matomo > Dashboard > Contents nothing is displayed. I only get “There is no data for this report”. My Matomo is set up to gather the data every 10 seconds but even if I wait nothing shows up. The date is set correctly so this is not the problem. There is just not any data :(
Any help on how to get content tracking working would be cool!
[2021-09-17 08:50:49] piwik.DEBUG: Website 3 tracker cache was re-created. [] {"class":"Piwik\\Tracker\\Cache","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Current datetime: 2021-09-17 08:50:49 {"date":"2021-09-17 08:50:49"} {"class":"Piwik\\Tracker","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\CoreHome\Tracker\VisitRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\IntranetMeasurable\Tracker\RequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\Actions\Tracker\ActionsRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\Goals\Tracker\GoalsRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\Ecommerce\Tracker\EcommerceRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\SitesManager\Tracker\SitesManagerRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\PrivacyManager\Tracker\RequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: General tracker cache was re-created. [] {"class":"PrivacyManager","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\Heartbeat\Tracker\PingRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\PagePerformance\Tracker\PerformanceDataProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\CustomDimensions\Tracker\CustomDimensionsRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:49] piwik.DEBUG: Executing Piwik\Plugins\CoreHome\Tracker\VisitRequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: DoNotTrack header not found [] {"class":"PrivacyManager","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Visitor doesn't have the piwik cookie... [] {"class":"CoreHome","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: The visitor was not matched with an existing visitor... [] {"class":"CoreHome","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\IntranetMeasurable\Tracker\RequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Actions\Tracker\ActionsRequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: (this is not a Site Search request) [] {"class":"Actions","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Excluding parameters "gclid,fbclid,fb_xd_fragment,fb_comment_id,phpsessid,jsessionid,sessionid,aspsessionid,doing_wp_cron,sid,pk_vid,pk_cpn,pk_campaign,piwik_campaign,mtm_campaign,matomo_campaign,utm_campaign,utm_source,utm_medium,pk_kwd,pk_keyword,piwik_kwd,mtm_kwd,mtm_keyword,matomo_kwd,utm_term,mtmPreviewMode" from URL [] {"class":"Contents","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Action is a CONTENT, Action name = , Action URL = http://localhost/pageIntro {"type":"CONTENT","name":null,"url":"http://localhost/pageIntro"} {"class":"Actions","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Goals\Tracker\GoalsRequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Ecommerce\Tracker\EcommerceRequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\SitesManager\Tracker\SitesManagerRequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\PrivacyManager\Tracker\RequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Heartbeat\Tracker\PingRequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\PagePerformance\Tracker\PerformanceDataProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\CustomDimensions\Tracker\CustomDimensionsRequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\CoreHome\Tracker\VisitRequestProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Visitor IP (was: 84.179.163.142) has been anonymized: 84.179.0.0 [] {"class":"PrivacyManager","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\IntranetMeasurable\Tracker\RequestProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Actions\Tracker\ActionsRequestProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: idaction_content_interaction = click [] {"class":"Actions","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: idaction_content_name = Merkzettel > ausdrucken [] {"class":"Actions","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: idaction_content_piece = Button [] {"class":"Actions","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: idaction_content_target = Drucker [] {"class":"Actions","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Goals\Tracker\GoalsRequestProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Ecommerce\Tracker\EcommerceRequestProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\SitesManager\Tracker\SitesManagerRequestProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\PrivacyManager\Tracker\RequestProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Heartbeat\Tracker\PingRequestProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\PagePerformance\Tracker\PerformanceDataProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\CustomDimensions\Tracker\CustomDimensionsRequestProcessor::afterRequestProcessed()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: New Visit (IP = 84.179.0.0) [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Following dimensions have been collected from plugins: idsite, profilable, user_id, visit_first_action_time, visit_first_action_time, visit_goal_buyer, visit_goal_converted, idvisit, location_ip, visit_last_action_time, visit_last_action_time, visit_last_action_time, visit_last_action_time, visit_last_action_time, visit_last_action_time, visit_last_action_time, visit_last_action_time, visit_last_action_time, visit_last_action_time, visit_last_action_time, visitor_seconds_since_first, visitor_seconds_since_order, config_id, idvisitor, visitor_returning, visitor_seconds_since_first, visitor_seconds_since_order, visitor_count_visits, visit_entry_idaction_name, visit_entry_idaction_url, visit_exit_idaction_name, visit_exit_idaction_url, visit_total_actions, visit_total_interactions, visit_total_searches, , referer_keyword, referer_name, referer_type, referer_url, , location_browser_lang, config_browser_engine, config_browser_name, config_browser_version, config_client_type, config_device_brand, config_device_model, config_device_type, config_os, config_os_version, visit_total_events, visitor_localtime, visitor_localtime, visitor_seconds_since_last, visitor_seconds_since_last, config_resolution, config_cookie, config_flash, config_java, config_pdf, config_quicktime, config_realplayer, config_silverlight, config_windowsmedia, , visit_total_time, location_city, location_country, location_latitude, location_longitude, location_region [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Excluding parameters "gclid,fbclid,fb_xd_fragment,fb_comment_id,phpsessid,jsessionid,sessionid,aspsessionid,doing_wp_cron,sid,pk_vid,pk_cpn,pk_campaign,piwik_campaign,mtm_campaign,matomo_campaign,utm_campaign,utm_source,utm_medium,pk_kwd,pk_keyword,piwik_kwd,mtm_kwd,mtm_keyword,matomo_kwd,utm_term,mtmPreviewMode" from URL [] {"class":"Referrers","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Excluding parameters "gclid,fbclid,fb_xd_fragment,fb_comment_id,phpsessid,jsessionid,sessionid,aspsessionid,doing_wp_cron,sid,pk_vid,pk_cpn,pk_campaign,piwik_campaign,mtm_campaign,matomo_campaign,utm_campaign,utm_source,utm_medium,pk_kwd,pk_keyword,piwik_kwd,mtm_kwd,mtm_keyword,matomo_kwd,utm_term,mtmPreviewMode" from URL [] {"class":"Referrers","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Excluding parameters "gclid,fbclid,fb_xd_fragment,fb_comment_id,phpsessid,jsessionid,sessionid,aspsessionid,doing_wp_cron,sid,pk_vid,pk_cpn,pk_campaign,piwik_campaign,mtm_campaign,matomo_campaign,utm_campaign,utm_source,utm_medium,pk_kwd,pk_keyword,piwik_kwd,mtm_kwd,mtm_keyword,matomo_kwd,utm_term,mtmPreviewMode" from URL [] {"class":"Referrers","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Excluding parameters "gclid,fbclid,fb_xd_fragment,fb_comment_id,phpsessid,jsessionid,sessionid,aspsessionid,doing_wp_cron,sid,pk_vid,pk_cpn,pk_campaign,piwik_campaign,mtm_campaign,matomo_campaign,utm_campaign,utm_source,utm_medium,pk_kwd,pk_keyword,piwik_kwd,mtm_kwd,mtm_keyword,matomo_kwd,utm_term,mtmPreviewMode" from URL [] {"class":"Referrers","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: GEO: Found IP 84.179.0.0 location (provider 'geoip2php'): array ( 'continent_name' => 'Europe', 'continent_code' => 'EU', 'country_code' => 'DE', 'country_name' => 'Germany', 'city_name' => 'Frankfurt am Main', 'lat' => 50.111, 'long' => 8.682, 'postal_code' => NULL, 'region_code' => '', 'region_name' => 'Hesse', ) [] {"class":"UserCountry","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: array ( 'idvisitor' => '0c2756fcc3999c88', 'config_id' => '3c3e30bf4f81fba0', 'location_ip' => '84.179.0.0', 'idsite' => 3, 'profilable' => 0, 'visit_first_action_time' => '2021-09-17 08:50:49', 'visit_goal_buyer' => 0, 'visit_goal_converted' => 0, 'visit_last_action_time' => '2021-09-17 08:50:49', 'visitor_returning' => 0, 'visitor_seconds_since_first' => 0, 'visitor_seconds_since_order' => NULL, 'visitor_count_visits' => 1, 'visit_entry_idaction_name' => 0, 'visit_exit_idaction_name' => 0, 'visit_exit_idaction_url' => 0, 'visit_total_actions' => 0, 'visit_total_interactions' => 0, 'visit_total_searches' => 0, 'referer_keyword' => NULL, 'referer_name' => NULL, 'referer_type' => 1, 'referer_url' => '', 'location_browser_lang' => 'de-de', 'config_browser_engine' => 'Blink', 'config_browser_name' => 'CH', 'config_browser_version' => '93.0', 'config_client_type' => 1, 'config_device_brand' => 'AP', 'config_device_model' => 'generic desktop', 'config_device_type' => 0, 'config_os' => 'MAC', 'config_os_version' => '10.15', 'visit_total_events' => 0, 'visitor_localtime' => '13:45:35', 'visitor_seconds_since_last' => 0, 'config_resolution' => '1920x1080', 'config_cookie' => 1, 'config_flash' => 0, 'config_java' => 0, 'config_pdf' => 1, 'config_quicktime' => 0, 'config_realplayer' => 0, 'config_silverlight' => 0, 'config_windowsmedia' => 0, 'visit_total_time' => 0, 'location_city' => 'Frankfurt am Main', 'location_country' => 'de', 'location_latitude' => '50.111', 'location_longitude' => '8.682', 'location_region' => '', ) [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\CoreHome\Tracker\VisitRequestProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\IntranetMeasurable\Tracker\RequestProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Actions\Tracker\ActionsRequestProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Inserted new action: array ( 'idvisit' => '14', 'idsite' => 3, 'idvisitor' => '0c2756fcc3999c88', 'idaction_url' => '71', 'idaction_url_ref' => 0, 'idaction_name_ref' => 0, 'server_time' => '2021-09-17 08:50:49', 'idpageview' => 'DrZS1j', 'time_spent_ref_action' => 0, 'idaction_content_interaction' => '72', 'idaction_content_name' => '81', 'idaction_content_piece' => '77', 'idaction_content_target' => '82', 'idlink_va' => '616', ) {"action":"array (\n 'idvisit' => '14',\n 'idsite' => 3,\n 'idvisitor' => '0c2756fcc3999c88',\n 'idaction_url' => '71',\n 'idaction_url_ref' => 0,\n 'idaction_name_ref' => 0,\n 'server_time' => '2021-09-17 08:50:49',\n 'idpageview' => 'DrZS1j',\n 'time_spent_ref_action' => 0,\n 'idaction_content_interaction' => '72',\n 'idaction_content_name' => '81',\n 'idaction_content_piece' => '77',\n 'idaction_content_target' => '82',\n 'idlink_va' => '616',\n)"} {"class":"Actions","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Goals\Tracker\GoalsRequestProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Ecommerce\Tracker\EcommerceRequestProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\SitesManager\Tracker\SitesManagerRequestProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\PrivacyManager\Tracker\RequestProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\Heartbeat\Tracker\PingRequestProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\PagePerformance\Tracker\PerformanceDataProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: Executing Piwik\Plugins\CustomDimensions\Tracker\CustomDimensionsRequestProcessor::recordLogs()... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:50] piwik.DEBUG: -> Scheduled Tasks: Starting... [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:58] piwik.DEBUG: 2021-09-17 08:50:50 matomo-test[99237]: starts for 1 2021-09-17 08:50:50 matomo-test[99237]: EXCEPTION: Handler::Handler: the listen descriptor is not a socket [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:58] piwik.DEBUG: Finished Scheduled Tasks. [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:58] piwik.DEBUG: Next run will be from: 2021-09-16 12:26:55 UTC [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:58] piwik.DEBUG: Nothing to notice => default behaviour [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:58] piwik.DEBUG: End of the page. [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:58] piwik.DEBUG: <hr /><strong>Breakdown by query</strong><br/>Executed <b>2</b> times in <b>0.8ms</b> (average = <b>0.4ms</b>) <pre> SELECT idsite, url FROM matomo_site_url</pre>Executed <b>2</b> times in <b>1.2ms</b> (average = <b>0.6ms</b>) <pre> SELECT idsite, main_url as url FROM matomo_site</pre>Executed <b>6</b> times in <b>2.5ms</b> (average = <b>0.4ms</b>) <pre> SELECT * FROM matomo_custom_dimensions WHERE idsite = ?</pre>Executed <b>6</b> times in <b>3.1ms</b> (average = <b>0.5ms</b>) <pre> SELECT url FROM matomo_site_url WHERE idsite = ?</pre>Executed <b>1</b> time in <b>3.5ms</b> <pre> UPDATE matomo_log_link_visit_action SET time_network = ?, time_server = ?, time_transfer = ?, time_dom_processing = ?, time_dom_completion = ?, time_on_load = ? WHERE idlink_va = ?</pre>Executed <b>6</b> times in <b>4ms</b> (average = <b>0.7ms</b>) <pre> SELECT * FROM matomo_goal WHERE idsite IN (3) AND deleted = 0</pre>Executed <b>7</b> times in <b>4ms</b> (average = <b>0.6ms</b>) <pre> SELECT option_name, option_value FROM `matomo_option` WHERE option_name LIKE ?</pre>Executed <b>12</b> times in <b>5.4ms</b> (average = <b>0.5ms</b>) <pre> SELECT login FROM matomo_access WHERE idsite = ? AND access = ?</pre>Executed <b>1</b> time in <b>6ms</b> <pre> INSERT IGNORE INTO `matomo_option` (option_name, option_value, autoload) VALUES (?, ?, ?) </pre>Executed <b>12</b> times in <b>6.1ms</b> (average = <b>0.5ms</b>) <pre> SELECT * FROM matomo_site WHERE idsite = ?</pre>Executed <b>7</b> times in <b>7.1ms</b> (average = <b>1ms</b>) <pre> SHOW COLUMNS FROM `matomo_log_conversion`</pre>Executed <b>7</b> times in <b>7.3ms</b> (average = <b>1ms</b>) <pre> SHOW INDEX FROM matomo_log_visit WHERE Key_name = ?</pre>Executed <b>10</b> times in <b>7.5ms</b> (average = <b>0.8ms</b>) <pre> SELECT `idaction`, `type`, `name` FROM matomo_log_action WHERE ( hash = CRC32(?) AND name = ? AND type = ? ) OR ( hash = CRC32(?) AND name = ? AND type = ? ) OR ( hash = CRC32(?) AND name = ? AND type = ? ) OR ( hash = CRC32(?) AND name = ? AND type = ? ) OR ( hash = CRC32(?) AND name = ? AND type = ? ) </pre>Executed <b>7</b> times in <b>7.5ms</b> (average = <b>1.1ms</b>) <pre> SHOW COLUMNS FROM `matomo_log_link_visit_action`</pre>Executed <b>7</b> times in <b>8.4ms</b> (average = <b>1.2ms</b>) <pre> SELECT option_value, option_name FROM `matomo_option` WHERE autoload = 1</pre>Executed <b>4</b> times in <b>10.2ms</b> (average = <b>2.6ms</b>) <pre> UPDATE `matomo_option` SET option_value = ?, autoload = ? WHERE option_name = ?</pre>Executed <b>10</b> times in <b>11ms</b> (average = <b>1.1ms</b>) <pre> SELECT visit_last_action_time, visit_first_action_time, idvisitor, idvisit, user_id, visit_exit_idaction_url, visit_exit_idaction_name, visitor_returning, visitor_seconds_since_first, visitor_seconds_since_order, visitor_count_visits, visit_goal_buyer, location_country, location_region, location_city, location_latitude, location_longitude, referer_name, referer_keyword, referer_type, idsite, profilable, visit_entry_idaction_url, visit_total_actions, visit_total_interactions, visit_total_searches, referer_url, config_browser_name, config_client_type, config_device_brand, config_device_model, config_device_type, visit_total_events, visit_total_time, location_ip, location_browser_lang, last_idlink_va, custom_dimension_1, custom_dimension_2, custom_dimension_3, custom_dimension_4, custom_dimension_5 FROM matomo_log_visit WHERE visit_last_action_time >= ? AND visit_last_action_time <= ? AND idsite = ? AND config_id = ? ORDER BY visit_last_action_time DESC LIMIT 1</pre>Executed <b>1</b> time in <b>11.2ms</b> <pre> SELECT idlink_va FROM matomo_log_link_visit_action LEFT JOIN matomo_log_action ON idaction_url = idaction WHERE idvisit = ? AND idpageview = ? AND matomo_log_action.type = ?</pre>Executed <b>7</b> times in <b>11.6ms</b> (average = <b>1.7ms</b>) <pre> SHOW COLUMNS FROM `matomo_log_visit`</pre>Executed <b>4</b> times in <b>19.6ms</b> (average = <b>4.9ms</b>) <pre> INSERT INTO matomo_log_visit (idvisitor, config_id, location_ip, idsite, profilable, visit_first_action_time, visit_goal_buyer, visit_goal_converted, visit_last_action_time, visitor_returning, visitor_seconds_since_first, visitor_seconds_since_order, visitor_count_visits, visit_entry_idaction_name, visit_exit_idaction_name, visit_exit_idaction_url, visit_total_actions, visit_total_interactions, visit_total_searches, referer_keyword, referer_name, referer_type, referer_url, location_browser_lang, config_browser_engine, config_browser_name, config_browser_version, config_client_type, config_device_brand, config_device_model, config_device_type, config_os, config_os_version, visit_total_events, visitor_localtime, visitor_seconds_since_last, config_resolution, config_cookie, config_flash, config_java, config_pdf, config_quicktime, config_realplayer, config_silverlight, config_windowsmedia, visit_total_time, location_city, location_country, location_latitude, location_longitude, location_region) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)</pre>Executed <b>6</b> times in <b>20ms</b> (average = <b>3.3ms</b>) <pre> UPDATE matomo_log_visit SET profilable = ?, visit_last_action_time = ?, visitor_seconds_since_order = ?, visit_total_time = ? WHERE idsite = ? AND idvisit = ?</pre>Executed <b>10</b> times in <b>38.5ms</b> (average = <b>3.9ms</b>) <pre> INSERT INTO matomo_log_link_visit_action (idvisit, idsite, idvisitor, idaction_url, idaction_url_ref, idaction_name_ref, server_time, idpageview, pageview_position, time_spent_ref_action, idaction_content_interaction, idaction_content_name, idaction_content_piece, idaction_content_target) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)</pre>Executed <b>10</b> times in <b>75.4ms</b> (average = <b>7.5ms</b>) <pre> connect</pre>Executed <b>253</b> times in <b>105ms</b> (average = <b>0.4ms</b>) <pre> SELECT option_value FROM `matomo_option` WHERE option_name = ?</pre> [] {"class":"Piwik\\Profiler","request_id":"40dff"}
[2021-09-17 08:50:58] piwik.DEBUG: array ( 'matomo_lang' => 'language=ZW4=', 'MATOMO_SESSID' => 'a9584809c1410c70a76f3352df6afa86', ) [] {"class":"Piwik\\Common","request_id":"40dff"}
[2021-09-17 08:50:58] piwik.DEBUG: Time elapsed: 8.759s [] {"class":"Piwik\\Common","request_id":"40dff"}```
Related
Reactjs : how to reduce the array of objects to get the sum
I have the array of objects and I want to group by description with the sum of credit. I tried with my code, but it doesn't work. What's wrong with it? My Code: var result1=[] entries.reduce((res, value) => { if (!res[value.description]) { res[value.description] = {description: value.description, credit: 0} result1.push(res[value.description]) } res[value.description].credit= (parseFloat(value.credit) + parseFloat(res[value.description].credit)).toFixed(2) return res }, {}); let analysisByDescStr = result1.map((str) => ( <div> {str.description|| ""} = {str.credit|| ""} </div> )); Array pf objects: {description: 'GOOGLE *Google', credit: '1.99', category: 'TELECOM'} {description: 'AMZN Mktp #0998', credit: '20.65', category: 'MERCHANDISE'} {description: 'AMZN Mktp #06778', credit: '70.68', category: 'MERCHANDISE'} {description: 'OLIVE YOUNG', credit: '60.03', category: 'MERCHANDISE'} {description: 'SAFEWAY #0982', credit: '22.97', category: 'GROCERY'} {description: 'PEET'S #11702', credit: '7.05', category: 'COFFEE'} {description: 'SAFEWAY #0983', credit: '20.00', category: 'GROCERY'} {description: 'AMZN Mktp #0234', credit: '-18.62', category: 'MERCHANDISE'} My Expected Result : AMZN Mktp=72.71 GOOGLE *Google=1.99 OLIVE YOUNG=60.03 PEET'S=7.05 SAFEWAY=42.97
You can use reduce and apply whatever transformation you need to your item.description to match your expected labels const result = list.reduce((acc, item) => { const label = item.description.substring(0, 7); return { ...acc, [label]: (acc[label] ?? 0) + Number(item.credit) } }, {})
How to transform object into array?
I have an object which is dynamically built. I need to get some of the fields of this object (exactly the dynamic ones) and parse them into an array. In the code below, I need to transform the towers[X] into an array of objects. {id: "", description: "Teste", towers[1]: true, towers[2]: true, towers[3]: true, …} description: "Test" id: "" towers[1]: true towers[2]: true towers[3]: true towers[4]: "" } I want it to be something like: { id: "" description: "Test", towers[1]: true //Don't care if it stays here or not, will not use ... } And a new array like: { [id: 1, value: true], [id: 2, value: true], [id: 3, value: true], [id: 4, value: ""] }
Just going to guess towers[0] gives back a number, if it does you can do this. This will find all keys that have boolean values and keep them and append them to a object. const obj = YOUROBJHERE; Object.keys(obj ).filter((key) => tyepof obj[key] === "boolean").reduce((accum, key) => { return {...accum, [key]: obj[key]}; }, {})
in case of X=number and obj is the object we want to transform let result = []; for (let indx = 1; indx <=x ; i++) { result.push({value:indx,value: obj['towers'+indx]}) }
If you want to transform your array of object you can do some like: this.obj=this.obj.map(obj=>{ return { id:obj.id, description:obj.description, towers:Object.keys(obj).filter((key) => key.indexOf('towers') != -1 ) .map((k,index)=>{ return {id:index+1,value:obj[k]} }) .filter((x:any)=>x.value) } }) See that, map allow an "index" (begins by 0)
MongoDB: Query Builder to Update Field
I'm trying update a field in my mongodb collection with c# driver. :: The Person Object { Name: 'Person1' Prefers: [ { Name: 'Prefer1', Location: 'Lisbon', Sports: [ { Name: 'Sports1', Indoor: true, OutDoor: false } ] ] } My 'Sports' objects is a List of interface: ISports How I update the field Person.Prefers.Sports.Name? The next code don't work for me: var filter = Builders<Person>.Filter.And( Builders<Person>.Filter.Eq(i => i.Id, X), Builders<Person>.Filter.ElemMatch(i => i.Prefers, i => i.Id == Y) Builders<Person>.Filter.Eq("Person.Prefers.Sports.Id", Z) ); var update = Builders<Person>.Update.Set("Prefers.Sports.$.Name", "Sports2"); UpdateOne(filter , update); Thanks
React - Rails 5 Action Cable
I've tried multiple things now but i cannot seem to get messages to be broadcasted to the clients. In this application, i got a react component that does the channel subscription. My console output for application connected is showing up in my log but received is just not being called. My React component: # app/assets/javascripts/components/records.js.coffee App.record = null #Records = React.createClass getInitialState: -> #setupSubscription() records: #props.data getDefaultProps: -> records: [] setupSubscription: -> App.record = App.cable.subscriptions.create "RecordChannel", connected: -> console.log "connected to RecordChannel" # Timeout here is needed to make sure Subscription # is setup properly, before we do any actions. #setTimeout: -> # this.perform 'follow', # {message_id: this.message_id} # ,1000 received: (data) -> console.log "data received" #addRecord(data) #record_subs = App.record addRecord: (record) -> records = React.addons.update(#state.records, { $push: [record] }) #setState records: records deleteRecord: (record) -> index = #state.records.indexOf record records = React.addons.update(#state.records, { $splice: [[index,1]] }) #replaceState records: records updateRecord: (record,data) -> index = #state.records.indexOf record records = React.addons.update(#state.records, { $splice: [[index,1,data]] }) #replaceState records: records credits: -> credits = #state.records.filter (val) -> val.amount >= 0 credits.reduce ((prev, curr) -> prev + parseFloat(curr.amount) ), 0 debits: -> debits = #state.records.filter (val) -> val.amount < 0 debits.reduce ((prev, curr) -> prev + parseFloat(curr.amount) ), 0 balance: -> #debits() + #credits() render: -> React.DOM.div className: 'records' React.DOM.h2 className: 'title' 'Records' React.DOM.div className: 'row' React.createElement AmountBox, type: 'success', amount: #credits(), text: 'Credit' React.createElement AmountBox, type: 'danger', amount: #debits(), text: 'Debit' React.createElement AmountBox, type: 'info', amount: #balance(), text: 'Balance' React.createElement RecordForm, handleNewRecord: #addRecord React.DOM.hr null React.DOM.table className: 'table table-bordered' React.DOM.thead null, React.DOM.tr null, React.DOM.th null, 'Date' React.DOM.th null, 'Title' React.DOM.th null, 'Amount' React.DOM.th null, 'Actions' React.DOM.tbody null, for record in #state.records React.createElement Record, key: record._id["$oid"], record: record, handleDeleteRecord: #deleteRecord, handleEditRecord: #updateRecord Not sure which other piece of code you need to see, just let me know and i will post it
i finally figured out what was wrong in my application. My subscription method was wrong in the stack. Turns out that i was using stream_for instead of stream_for in my subscription! class RecordChannel < ApplicationCable::Channel def subscribed # stream_from "some_channel" stream_for ("record_#{current_user['info']['nickname']}_channel") end to class RecordChannel < ApplicationCable::Channel def subscribed # stream_from "some_channel" stream_from ("record_#{current_user['info']['nickname']}_channel") end
soapUI - Parse JSON Response containing arrays
Given the following JSON response from a previous test step (request) in soapUI: { "AccountClosed": false, "AccountId": 86270, "AccountNumber": "2915", "AccountOwner": 200000000001, "AccountSequenceNumber": 4, "AccountTotal": 6, "ActiveMoneyBeltSession": true, "CLMAccountId": "", "CustomerName": "FRANK", "Lines": [{ "AndWithPreviousLine": false, "IngredientId": 10000025133, "OrderDestinationId": 1, "PortionTypeId": 1, "Quantity": 1, "QuantityAsFraction": "1", "SentToKitchen": true, "TariffPrice": 6, "Id": 11258999068470003, "OriginalRingUpTime": "2014-10-29T07:37:38", "RingUpEmployeeName": "Andy Bean", "Seats": [] }, { "Amount": 6, "Cashback": 0, "Change": 0, "Forfeit": 0, "InclusiveTax": 1, "PaymentMethodId": 1, "ReceiptNumber": "40/1795", "Tip": 0, "Id": 11258999068470009, "Seats": [] }], "MoaOrderIdentifier": "A2915I86270", "OutstandingBalance": 0, "SaveAccount": false, "ThemeDataRevision": "40", "TrainingMode": false } I have the following groovy script to parse the information from the response: import groovy.json.JsonSlurper //Define Variables for each element on JSON Response String AccountID, AccountClosed, AccountOwner, AccountSeqNumber, AccountTotal, ActMoneyBelt String CLMAccountID, ThemeDataRevision, Lines, MoaOrderIdentifier, OutstandingBalance, SaveAccount, TrainingMode, CustName, AccountNumber String AndWithPreviousLine, IngredientId, OrderDestinationId, PortionTypeId, Quantity, SentToKitchen, TariffPrice, Id, OriginalRingUpTime, RingUpEmployeeName, Seats int AccSeqNumInt def responseContent = testRunner.testCase.getTestStepByName("ReopenAcc").getPropertyValue("response") // Create JsonSlurper Object to parse the response def Response = new JsonSlurper().parseText(responseContent) //Parse each element from the JSON Response and store in a variable AccountClosed = Response.AccountClosed AccountID = Response.AccountId AccountNumber = Response.AccountNumber AccountOwner = Response.AccountOwner AccountSeqNumber = Response.AccountSequenceNumber AccountTotal = Response.AccountTotal ActMoneyBelt = Response.ActiveMoneyBeltSession CLMAccountID = Response.CLMAccountId CustName = Response.CustomerName Lines = Response.Lines /*Lines Variables*/ AndWithPreviousLine = Response.Lines.AndWithPreviousLine IngredientId = Response.Lines.IngredientId OrderDestinationId = Response.Lines.OrderDestinationId PortionTypeId = Response.Lines.PortionTypeId Quantity = Response.Lines.Quantity SentToKitchen = Response.Lines.SentToKitchen TariffPrice = Response.Lines.TariffPrice Id = Response.Lines.Id OriginalRingUpTime = Response.Lines.OriginalRingUpTime RingUpEmployeeName = Response.Lines.RingUpEmployeeName Seats = Response.Lines.Seats /*End Lines Variables*/ MoaOrderIdentifier = Response.MoaOrderIdentifier OutstandingBalance = Response.OutstandingBalance SaveAccount = Response.SaveAccount ThemeDataRevision = Response.ThemeDataRevision TrainingMode = Response.TrainingMode As you can see above there is an element (Array) called "Lines". I am looking to get the individual element value within this array. My code above when parsing the elements is returning the following: ----------------Lines Variables---------------- INFO: AndWithPreviousLine: [false, null] INFO: IngredientId: [10000025133, null] INFO: OrderDestinationId: [1, null] INFO: PortionTypeId: [1, null] INFO: Quantity: [1.0, null] INFO: SentToKitchen: [true, null] INFO: TariffPrice: [6.0, null] INFO: Id: [11258999068470003, 11258999068470009] INFO: OriginalRingUpTime: [2014-10-29T07:37:38, null] INFO: RingUpEmployeeName: [Andy Bean, null] INFO: Seats: [[], []] How can i get the required element from the above, also note the the 2 different data contracts contain the same element "ID". Is there a way to differenciate between the 2. any help appreciated, thanks.
The "Lines" in the Response can be treated as a simple list of maps. Response["Lines"].each { println it } [AndWithPreviousLine:false, Id:11258999068470003, IngredientId:10000025133, OrderDestinationId:1, OriginalRingUpTime:2014-10-29T07:37:38, PortionTypeId:1, Quantity:1, QuantityAsFraction:1, RingUpEmployeeName:Andy Bean, Seats:[], SentToKitchen:true, TariffPrice:6] [Amount:6, Cashback:0, Change:0, Forfeit:0, Id:11258999068470009, InclusiveTax:1, PaymentMethodId:1, ReceiptNumber:40/1795, Seats:[], Tip:0] The Response is just one huge map, with the Lines element a list of maps. Using groovysh really helps here to interactively play with the data, i did the following commands after starting a "groovysh" console: import groovy.json.JsonSlurper t = new File("data.json").text r = new JsonSlurper().parse(t) r r["Lines"] r["Lines"][0] etc Edit: In response to your comment, here's a better way to get the entry with a valid AndWithPreviousLine value. myline = r["Lines"].find{it.AndWithPreviousLine != null} myline.AndWithPreviousLine >>> false myline.IngredientId >>> 10000025133 If you use findAll instead of find you'll get an array of maps and have to index them, but for this case there's only 1 and find gives you the first whose condition is true. By using Response["Lines"].AndWithPreviousLine [0] you're assuming AndWithPreviousLine exists on each entry, which is why you're getting nulls in your lists. If the json responses had been reversed, you'd have to use a different index of [1], so using find and findAll will work better for you than assuming the index value.