New Relic

Get a Zipy session URL against Browser Interactions in 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.

<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.

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

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.

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

Last updated