---
title: "New Relic Browser Monitoring not working under Drupal 10.2+"
date: "2024-06-10T19:04:10+00:00"
summary:
image:
type: "article"
url: "/acquia-cloud-platform/help/93161-new-relic-browser-monitoring-not-working-under-drupal-102"
id: "e6cae65d-cd87-4054-905b-9a517f4623ab"
---

Issue
-----

Due to the [change in Drupal 10.2 which introduces the Content-Length header on Drupal responses](https://www.drupal.org/node/3298551) , the New Relic automatic injection of the Browser-side tracking Javascript code becomes disabled whenever that header is present. Thus, if your application depends on this information, actions must be taken to resolve.  
  
This issue **only impacts** sites that need the **Browser Monitoring** in New Relic (which includes metrics like browser-side timing of rendering, networking, page views, etc). The APM (Application Performance Monitoring) feature which tracks the performance of Drupal/PHP and dependencies like MySQL, Memcache and external requests is **unaffected**. 

Resolution
----------

New Relic's automatic insertion of this code [is incompatible with the Content-Length header](https://docs.newrelic.com/docs/apm/agents/php-agent/features/browser-monitoring-php-agent/#:~:text=Auto%2Dinstrumentation%20does%20not%20work%20when%20the%20HTTP%20header%20field%20Content%2DLength) . New Relic recommends manual instrumentation in these instances, meaning that the Javascript should now be inserted by the web application instead of the New Relic agent.  
  
As of June 2024, Acquia is working on a robust solution. For now, customers can implement one of the workarounds below:

### Option 1) Use a patched version of the New Relic Drupal module

Acquia is working with the Drupal open-source community to add the needed feature to the [New Relic contrib module](https://www.drupal.org/project/new_relic_rpm/), which is hosted and maintained on [Drupal.org](http://drupal.org/). We have opened a [merge request](https://www.drupal.org/project/new_relic_rpm/issues/3444218) to add manual instrumentation, and our goal is for it to be merged and released by the module's maintainers.  
  
In the meantime, you can choose to install the module patched with the merge request code, which should insert the needed JS into all Drupal-generated responses.  
  
If you need guidance on how to do this with Composer, see the [Drupal.org documentation on Applying a patch in a feature branch](https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupal/working-with-patches/applying-a-patch-in-a-feature-branch#s-composer) . **Ensure you clear all caches** (including Varnish) after doing this.

### Option 2) Write a custom module to insert the New Relic Javascript code  
  
If you are familiar with writing custom modules, you can insert the code via a custom module. For guidance, consult the above-cited [merge request](https://www.drupal.org/project/new_relic_rpm/issues/3444218).

### Option 3) Wait or do nothing  
  
If you do not really need the Browser-side data collection, or want to wait for a final version of the New Relic contributed module (instead of patching), you can choose to do so.  
  
In any event, we recommend you follow the issue on Drupal.org: [https://www.drupal.org/project/new\_relic\_rpm/issues/3444218](https://www.drupal.org/project/new_relic_rpm/issues/3444218)