We need create a way to combine Google Analytics data and Drupal data.

Original report:


Is it possible to add the node relationship as an option? I can imagine the node ID isn't stored in GA, but shouldn't it be possible to get the node ID via the path?

Kind regards,



grendzy’s picture

4.33 KB

It's something I've fiddled with a little. A relationship in the usual way is impossible, because there's no way to "join" GA data with SQL data in a single query. I'm trying to find a way to execute two queries and combine the results before rendering, but Views isn't really designed for this.

Non-working patch attached with my experiment so for.

If you need this functionality now, my advice is to use a theme pre-process function to load the node data, or write your reports using google_analytics_api_report_data().

dwkitchen’s picture

Issue summary: View changes
Status: Active » Needs review
4.02 KB

I have also been looking for a method to do this.

What I came up with is a argument handler. All this offers is the most viewed node ids.

Add nid to the arguments and then select default value, you can now select Google Analytics in the list.

If this looks like a good way to go it can be developed further.

dwkitchen’s picture

Here is a new patch, you can now enter manual options for filters etc.

dwkitchen’s picture

Updated version with corrections for sorting and filtering.

Plazik’s picture

Title: Node relation » Node, User, Organic Groups and others Entities relationships
Component: Views module » Reports module
Plazik’s picture

nicoz’s picture

Status: Needs review » Needs work

Looks like there is some great work going on here. Tested against latest dev and the patch no longer applies. Looks like there was a some restructuring after this patch was made.

loparr’s picture

Can anybody confirm that this patch works? What other solutions do we have regarding pulling data from analytics and using it with data from drupal? Thank you.