INN / Google-Analytics-Popular-Posts

A WordPress plugin that uses Google Analytics data to determine the most popular posts on your site and display a list of popular posts via the included widget.
https://wordpress.org/plugins/ga-popular-posts/
23 stars 7 forks source link

No Data Showing #72

Closed shootingandscuba closed 4 years ago

shootingandscuba commented 7 years ago

I've setup the plugin for one site of a multi-site (network) installation as detailed on the setup guide, and I can see requests on the Google Developer side of things, but no data is showing in the plugin. All I get is "Most popular posts from Google Analytics, with a relative weighting average."

benlk commented 7 years ago

Hi @shootingandscuba, can you provide screenshots of what you're seeing in the plugin?

shootingandscuba commented 7 years ago

ss1 ss2 ss3

thanks for looking into this, screenshots attached!

benlk commented 7 years ago

Can you save a copy of the page and send it to us, or right click upon the widget and choose "Inspect Element" and tell us if you see a <table> element in there? I'd like to know whether the code that's in that widget is successfully outputting the fact that it finds no popular posts, or whether it's failing to output anything at all.

https://github.com/INN/Google-Analytics-Popular-Posts/blob/07e235585149e0ee24d4b9be6a6e3516ee58f64a/classes/AnalyticsDashWidget.php#L35-L58

If you have access to your server's PHP error log, any information from there that mentions this plugin would also be of use.

shootingandscuba commented 7 years ago

I've added a quick line of code to analytic-bridge.php to email me the output of pagesql and metricsql on execution within the function "query_and_save_analytics"

I get the following SQL queries

PAGE

INSERT INTO wp_analyticbridge_pages (pagepath, post_id) VALUES ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id)

METRIC

INSERT INTO wp_analyticbridge_metrics (page_id,startdate,enddate,querytime,metric,value) VALUES ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id),querytime=values(querytime),value=values(value)

Reading back through it looks like whatever code runs the condition for generating the value array for each insert is not being met.

Duncan

On 07/09/2017 16:14, Ben Keith wrote:

Can you save a copy of the page and send it to us, or right click upon the widget and choose "Inspect Element" and tell us if you see a |

| element in there? I'd like to know whether the code that's in that widget is successfully outputting the fact that it finds no popular posts, or whether it's failing to output anything at all.

https://github.com/INN/Google-Analytics-Popular-Posts/blob/07e235585149e0ee24d4b9be6a6e3516ee58f64a/classes/AnalyticsDashWidget.php#L35-L58

If you have access to your server's PHP error log, any information from there that mentions this plugin would also be of use.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/INN/Google-Analytics-Popular-Posts/issues/72#issuecomment-327830877, or mute the thread https://github.com/notifications/unsubscribe-auth/AeMSDbVLN1i1IPCWwA8aW_ajuFFmOaPoks5sgAhTgaJpZM4PM8X5.

benlk commented 7 years ago

Could you log the content of $report->rows sometime after the report is fetched from GA, after these lines https://github.com/INN/Google-Analytics-Popular-Posts/blob/d3a5ffccec1902fe158e7f69ba4f708f49e15fdd/analytic-bridge.php#L153-L163 but before the try ... catch statement?

shootingandscuba commented 7 years ago

a var_dump of the $report->rows before the try / catch returns empty

On 15/09/2017 22:23, Ben Keith wrote:

Could you log the content of |$report->rows| sometime after the report is fetched from GA, after these lines https://github.com/INN/Google-Analytics-Popular-Posts/blob/d3a5ffccec1902fe158e7f69ba4f708f49e15fdd/analytic-bridge.php#L153-L163 but before the |try ... catch| statement?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/INN/Google-Analytics-Popular-Posts/issues/72#issuecomment-329907611, or mute the thread https://github.com/notifications/unsubscribe-auth/AeMSDa6Z1K74803zs-UpR5HFW5DbMDtgks5siurngaJpZM4PM8X5.

benlk commented 7 years ago

What about var_dumping all of $report?

That $report->rows is empty suggests that something is wrong in the Google Analytics integration. Does your Google Analytics dashboard show any page views?