Installing with Google Tag Manager

Is it possible to install the NewRelic snippet in Google Tag Manager (in order to reduce page load)?

We don’t support this, because the New Relic script needs to be inline in the page head during load for best instrumentation, and should not affect page load timing in any significant way. See here for more on our philosophy and approach to page performance:

Browser monitoring and performance impact
Browser monitoring and SEO

Hi there,
Is google tag manger not supported yet?

Thank you,
Cheers

Hi, @henrique.elias: Alexis’ reply above is still accurate: the New Relic Browser agent should be placed inline as close to the top of the HEAD section as possible. Referencing an external script file may work, but is not supported.

Is it possible to call NewRelic methods form a Google Tag Manager Custom Tag?

1 Like

@joe.privett I’d love to hear more about your use case! Are you looking to implement one of the browser SPA API calls here and if yes, which one?

While I’m not familiar with custom tags, it looks like this allows you to add HTML elements to your page? As mentioned above, the browser agent should be installed inline in the head of the HTML and before other scripts load. It’s possible some may work, though timing may be an issue here as is the case with installing the agent via GTM, a question that is often asked. (The script gets bundled in with others and isn’t able to load quickly enough to perform as designed and reporting errors are common as a result.)

For example, setCustomAttribute() needs to load before window load event fires, see below.

https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setcustomattribute-browser-agent-api

We’re always curious to see how you’d like something to be implemented and hearing about your use case, so feel free to add more details here. Thanks!