Skip to content

Add report options builder classes for Analytics, AdSense and SC #11552

@benbowler

Description

@benbowler

Feature Description

This issue should add Core\Email_Reporting\Report_Options\Analytics_4_Report_Options, Search_Console_Report_Options and AdSense_Report_Options classes which will build report option arrays on php side, to be later used in report requests made from the backend

  • Connect the template to live user data
  • Format metrics to fit the template and designs
  • Handle edge cases with variance in metric value length

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • All report query objects should be created for the required reports.

Implementation Brief

  • Add Core\Email_Reporting\Report_Options\Analytics_4_Report_Options, Search_Console_Report_Options and AdSense_Report_Options classes
    • See includes/Modules/Analytics_4/Batch_Report_Builder.php in the PoC for examples on some translated report options for few KMW report options used in JS counterpart.
    • Build methods in the respective module class which return report options array, adapted from their JS report options counterparts. The metrics that should be included, following the email template sections, are:
      • Analytics module:
        • Total conversion events - total count of submit_lead_form, contact, or generate_lead
        • Products Added to cart - total count of addToCarts metric, and Top traffic source for the event (sessionDefaultChannelGroup dimension)
        • Purchases - total count of purchase metric and Top traffic source for the event (sessionDefaultChannelGroup dimension)
        • Total visitors - totalUser metrics count , and comparison to the previous vs current period difference in percentage
        • New Visitors - see assets/js/modules/analytics-4/components/widgets/NewVisitorsWidget.js
        • Returning Visitors - see assets/js/modules/analytics-4/components/widgets/ReturningVisitorsWidget.js
        • Traffic channels by visitor count - see assets/js/modules/analytics-4/components/widgets/TopTrafficSourceWidget.js use 3 for limit instead of 1
        • Pages with the most pageviews - see assets/js/modules/analytics-4/components/widgets/PopularContentWidget.js
        • Top authors by pageviews - see assets/js/modules/analytics-4/components/widgets/PopularAuthorsWidget.js
        • Top categories by pageviews - see assets/js/modules/analytics-4/components/widgets/TopCategoriesWidget.js
      • AdSense module:
        • Total earnings from AdSense - total count of totalAdRevenue metric.
      • Search Console module:
        • Total impressions on Search - see assets/js/modules/search-console/components/dashboard/SearchFunnelWidgetGA4/index.js and the usage of searchConsoleData in assets/js/modules/search-console/components/dashboard/SearchFunnelWidgetGA4/Overview/DataBlocks.js
        • Total clicks from Search - same as for Total impressions on Search
        • Keywords with highest CTR in Search - Extract this from the data retrieved from SC report in assets/js/modules/search-console/components/dashboard/DashboardPopularKeywordsWidget.js or assets/js/modules/search-console/components/widgets/PopularKeywordsWidget.js.
          Logged data example
          0 : {
          clicks: 10,
          ctr: 0.21739130434782608,
          impressions: 46,
          keys: Array(1),
          position: 22.91304347826087
          }
          1 : {
          clicks: 6,
          ctr: 0.10909090909090909,
          impressions: 55,
          keys: Array(1),
          position: 57.30909090909091
          }
          2 : {
          clicks: 4,
          ctr: 0.0784313725490196,
          impressions: 51,
          keys: Array(1),
          position: 30.07843137254902
          }
          3 : {
          clicks: 4,
          ctr: 0.0975609756097561,
          impressions: 41,
          keys: Array(1),
          position: 4.829268292682927
          }
          4 : {
          clicks: 3,
          ctr: 0.08571428571428572,
          impressions: 35,
          keys: Array(1),
          position: 24.542857142857144
          }
          5 : {
          clicks: 3,
          ctr: 0.3333333333333333,
          impressions: 9,
          keys: Array(1),
          position: 4.444444444444445
          }
          6 : {
          clicks: 2,
          ctr: 0.25,
          impressions: 8,
          keys: Array(1),
          position: 26.875
          }
          7 : {
          clicks: 2,
          ctr: 0.25,
          impressions: 8,
          keys: Array(1),
          position: 33.125
          }
          8 : {
          clicks: 2,
          ctr: 0.11764705882352941,
          impressions: 17,
          keys: Array(1),
          position: 6.176470588235294
          }
          9 : {
          clicks: 2,
          ctr: 0.2857142857142857,
          impressions: 7,
          keys: Array(1),
          position: 3.7142857142857144
          }
          . Sort data by ctr property
        • Pages with the most clicks from Search - see assets/js/modules/search-console/components/dashboard/DashboardPopularKeywordsWidget.js, dimensions should include pages
        • Top growing keywords in Search (CTR) - new data to be implemented in v1
        • Pages with the biggest increase in Search clicks - new data to be implemented in v1
        • Note currently SC does not support comparison dates out of the box, the diffs in the badges will be hardcoded as placeholders in the meantime, this will be computed in v1

Test Coverage

  • No tests needed

QA Brief

  • No QA needed, there is no user facing change that can be tested, only list of report arrays

Changelog entry

  • Add report options builder classes for Analytics, AdSense, and SC modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0High priorityTeam SIssues for Squad 1Type: EnhancementImprovement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions