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 within New Relic One. 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()})
For more help
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.