# New Relic

*Note: Make sure you have Zipy and New Relic installed on your site.*

### Step 1. Add the below code in \<head> tag on your site.

To get zipy session url with browser interaction we need to pass it as custom attribute to new relic.

```javascript
<script>
const getCurrentZipySessionURL = async () => {
  return await new Promise(function(resolve, reject) {
      let i = 0;
      const _interval = setInterval(() => {
          let zipySessionUrl = (window)?.zipy?.getCurrentSessionURL();
          
          if(zipySessionUrl){
              resolve(zipySessionUrl);
              clearInterval(_interval);
          }
          else{
              i++;
              if(i >= 4){
                reject("Some problem occurred while loading zipy.");
                clearInterval(_interval);
              }
          }
      },1500);
  });
}

getCurrentZipySessionURL()
.then(zipySessionUrl => {
    newrelic.setCustomAttribute('zipy_session_url',zipySessionUrl);
})
.catch((e) => {
    console.log(e);
});
</script>
```

### Step 2. Find Zipy session url in New Relic.

Go to **Query Your Data** section in New Relic.&#x20;

<div data-full-width="true"><figure><img src="/files/kHFMlnMcppTJJBoY1iJC" alt="" width="563"><figcaption></figcaption></figure></div>

Then put the below query in the input section and click run.

```sql
SELECT * FROM BrowserInteraction WHERE appName LIKE '<Your-Newrelic-App-Name>' 
```

*Note: Replace **\<Your-Newrelic-App-Name>** with your app name.*

You will be able to see Zipy Session Url against a BrowserInteraction in New Relic.&#x20;

<figure><img src="/files/Vc9wazH7PxcqdJ7BrCwJ" alt="" width="563"><figcaption></figcaption></figure>

For more information about `newrelic.setCustomAttribute()` please visit: <https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setcustomattribute/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zipy.ai/integration/new-relic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
