How to Track the Performance of Your New Content vs Old Content

| | 2 min read

Have you ever checked how your new content is performing vs the old content? I experimented with one of our high-traffic Drupal-based website projects to find this data. And this is what I get from the last seven days' data.

Chart that show the 7 days traffic with the content age group

What do you think about this website? Post your thoughts here

Here are the technical details of how I did it.

This is a Drupal website, and the content authored date is available in the dataLayer. The DataLayer module for Drupal will do this for you. It is a no-config/low-config module and will provide helpful information from the Drupal entities in the dataLayer.

In my project, the data is available here.

window.dataLayer[0].entityCreated

Now the steps are simple if you use Google Tag Manager.

1) Create a custom javascript variable in GTM with the following code.

function() {

  function days_in_sec(days) {
    return 86400 * days;
  }

  function content_age(created_timestamp) {
    today = Date.parse(new Date) / 1000;
    return today - created_timestamp;
  }

  function group_content_by_age(created_timestamp) {

    age = content_age(created_timestamp);

    if (age <= days_in_sec(7)) {
      return '0-7';
    }
    else if (age <= days_in_sec(30)) {
      return '8-30';
    }
    else if (age <= days_in_sec(90)) {
     return '31-90';
    }
    else if (age <= days_in_sec(180)) {
      return '91-180';
    }
    else if (age <= days_in_sec(365)) {
      return '181-365';
    }
    else if (age > days_in_sec(365)){
      return '>365';
    }
  }

  created_timestamp = window.dataLayer[0].entityCreated; // Change this to your dataLayer variable with the content authored-on date in the UNIX timestamp format.
  return group_content_by_age(created_timestamp);

}

2) Add the variable to the GA4 Configuration tag.

3) Preview and Deploy your changes.

You must add a custom dimension for the attribute to get the data in GA4 reports.

If you are a Drupal site owner (I will consider WordPress as well ?) and want to set up Google Tag Manager or  Migrate your universal analytics account to GA4, feel free to contact us. We can set up the Old Content vs New Content report also for you. ?