---
title: "Disabling New Relic agent injection"
date: "2024-02-14T06:18:38+00:00"
summary: "Learn how to disable New Relic agent injection on your Drupal site to prevent JavaScript conflicts and validation errors. Follow our step-by-step guide for seamless implementation and improved website performance."
image:
type: "page"
url: "/acquia-cloud-platform/disabling-new-relic-agent-injection"
id: "4eed1a72-2c9b-4645-8aea-94a81c4abf0f"
---

Acquia Support uses New Relic as a tool to help diagnose website performance problems. The New Relic service injects a small JavaScript agent into pages, allowing New Relic to gather data about the end user’s experience. This JavaScript injection may conflict with other JavaScript used on a website or cause validation errors, like the following validation error from Google’s AMP service:

    The tag 'script' is disallowed except in specific forms.

New Relic’s [documentation](https://docs.newrelic.com/docs/agents/php-agent/php-agent-api/newrelic_disable_autorum) provides the `newrelic_disable_autorum()` method to disable the injection of the New Relic Browser JavaScript agent for the current transaction.

To apply this code to a Drupal website, add the code for your version of Drupal to the bottom of your website’s `settings.php` file, adjusting `[path_to_ignore]` to the actual pages or paths you don’t want the New Relic agent to be injected into.

### Current Drupal version

    if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '[path_to_ignore]') !== false ) {
      if (extension_loaded('newrelic')) { // Ensure PHP agent is available
        newrelic_disable_autorum();
        }
    }

### Drupal 7

    if (isset($_GET['q']) && strpos($_GET['q'], '[path_to_ignore]') === 0) {
      if (extension_loaded('newrelic')) { // Ensure PHP agent is available
        newrelic_disable_autorum();
        }
        }