Proposed Enhancements:
Extend the module to allow storage of multiple date ranges.
Use Cases:
For large enterprise organizations (and small ones too), using data to drive decisions is extremely useful. It is likely that different decisions should be based on different time periods of data. Here are 3 examples:
Search Weighting:
In order to provide a better search experience to users, we would like to integrate google analytics data into our search ranking algorithm. For this, we would expect to use a “trending” weight which we would base it on a week’s worth of data (1 Week).
Expire/Retire Legacy Pages:
In order to keep our CMS clean and avoid months of clean-up down the road, we would like to integrate google analytics data into our CMS page auditing. For this we would look at a large set of data to identify pages which are outdated or trivial which are receiving little to no traffic over an extended amount of time (6 Months). These pages would be flagged for review and possible automatically unpublished once they hit certain thresholds.
Basic Site Health:
A majority of content authors in the organization do not have access to analytical tools like Google Analytics in a large organization. Being able to see how pages are performing helps the organization stay on top of trends/changes to their content. For this we would want to look at information for the last month to determine trends (1 month).
Proposed Path Forward:
Here is an outline of the high level architectural changes that would need to be made to the module:
- Update the database schemas to take into account a date_range for data which is imported.
- Update configuration to allow for multiple date ranges to be selected.
- Remove the existing field_google_analytics_counter field and replace with new fields per date range configuration enabled.
- Propose to remove the custom date range options and stick with:
- Yesterday
- Last Week
- Last Month
- Last 6 Months
- Last Year
- Since the beginning
- Update Fetch and Count cron logic to handle multiple date ranges.
Due to content model/field definition updates, it is recommended that this be done in a new version release branch (8.x-4.x) since users utilizing the 8.x-3.x branch would need to adjust configuration to account for this change. Examples would be Views, Search Indexing, etc…
Please let me know if you think this is something you are open to incorporating into your project. Of course there are more finite details that need to be ironed out, but an initial POC of this update based on the 3.x-alpha14 release can be found here: https://github.com/doylejd/google_analytics_counter/tree/feature/alpha14...
**Note that this is a POC. It is not polished and needs to be rebased/updated against the more recent releases. We would be happy to continue moving this forward if it is something you are interested in.