Important
To use this API, you need the Browser Pro+SPA edition of the browser agent.
Syntax
newrelic.interaction().actionText(string $value)
Sets the text value of the HTML element that was clicked to start a browser interaction.
Requirements
Agent version nr-1099 or higher.
Description
This SPA monitoring method sets the text value of the HTML element that was clicked to start a browser interaction. The value will be exposed as the actionText
attribute in the BrowserInteraction
event.
NOTE: The agent automatically attempts to determine the text value of the HTML element that was clicked. This applies only to <a>
, <button>
, and <input>
elements. The actionText
API can be used in cases where this is not sufficient or accurate.
Tip
This API call applies to data in SPA page views in browser and the BrowserInteraction
event type. To set a custom name for standard page views and the PageView
event type, see setPageViewName
. Using both calls together is recommended.
Parameters
Parameter | Description |
---|---|
string | The text value of the HTML element that represents the action that started the interaction. |
Return values
This method returns the same API object created by interaction()
.
Examples
document.getElementById('subscribe').addEventListener('submit', () => { newrelic.interaction().actionText('Create Subscription'); createSubscription();});