Score:0

How to add a relationship in google analytics reports views?

in flag

So I created a custom module and added a .inc file. Inside that file I've defined a hook_views_data() in which I have defined content entity relationship so that it supports GA reports.

Code in .inc file

function custom_module_views_data() {
  $data = [];
    
  // Define the relationship to the content entity.
  $data['google_analytics_reports']['content'] = [
    'title' => t('Content'),
    'help' => t('Relate the Google Analytics Reports to the associated content.'),
    'relationship' => [
      'title' => t('Content'),
      'help' => t('Relate the Google Analytics Reports to the associated content.'),
      'base' => 'node_field_data',
      'base field' => 'nid',
      'field' => 'google_analytics_reports_nid',
      'id' => 'standard',
      'label' => t('Content'),
    ],
  ];
  return $data;
}

But now when I add the content relationship and also the fields in error logs it's showing

Error: Call to undefined method Drupal\google_analytics_reports\Plugin\views\query\GoogleAnalyticsQuery::addRelationship() in Drupal\views\Plugin\views\relationship\RelationshipPluginBase->query()

What exactly I am doing wrong here?

id flag
I’m voting to close this question because it is reported as a change request on the module: https://www.drupal.org/project/google_analytics_reports/issues/3367021. If there is a more specific question on a particular aspect of authoring that change, that could be answerable here.
Libbna Mathew avatar
in flag
I have reformed my question hope this helps,
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.