Skip to content

Extract the audience utility logic from Analytics_4 to a new class. #9229

@techanvil

Description

@techanvil

Feature Description

There is a significant chunk of audience related code that is a prime candidate to lift out of the ever-growing Analytics_4 class into its own class.

We should extract the majority of the linked block of code to a new class called Analytics_4/Audience_Utilities which can be used within the Analytics_4 class.


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

Acceptance criteria

  • Audience utility methods should be lifted out of the Analytics_4 class as per the feature description.

Implementation Brief

Note: Please refer this POC PR.

  • Create an Audience_Utilities class inside includes/Modules/Analytics_4

    • Move all audiences related methods along with class properties and constants in Audience_Utilities class from Analytics_4 class as can be seen in reference PR.
  • In includes/Modules/Analytics_4.php

    • Create a property $audience_utilities which should be an instance of Audience_Utilities and instantiated inside constructor.
    • Call the methods on $audience_utilities instance which have been moved in the new class.

Test coverage

  • Fix any failing tests Analytics_4Test class.
  • Add tests for Audience_Utilities class.

QA Brief

Changelog entry

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions