Submit a ticket My Tickets Login

Sending custom data to tyGraph Pages

The tyGraph Pages engine automatically collects relevant data about the pages, sites, and user in your SharePoint environment.  When a developer has customized or built an application on top of SharePoint, he or she may want to collect additional custom data.  You can send this information on any modern SharePoint page using the window.tyGraph object.  This object is available on any SharePoint modern page assuming you have installed the tyGraph Pages engine.

Developers can utilize the following functions on the window.tyGraph object:

  • trackPageView(properties: any) - track a page view with your own custom properties
  • trackEvent(eventName: string, properties: any) - track a custom event named eventName with your own custom properties

The properties object can accept most simple JavaScript objects with key / value pairs.  The tyGraph Pages engine will automatically track the same properties it usually does such as page, site, and user information so you don't need to collect those yourself.

Code example

Simple example of using the trackEvent method:

window.tyGraph.trackEvent('myCustomEvent', { field1: 'stringValue', field2: 0 });

Reporting on custom data

We have built the reporting in tyGraph Pages around a pre-determined set of data values.  As a result, these reports won't contain your custom data.  If you need to report on your custom data, you can view it in Application Insights or build a Power BI report yourself.  If you can't build the Power BI report, please contact support and we'll provide you options to report on your data.