title | type | shortDescription | tags | metaDescription | redirects | freshnessValidatedDate | |||||
---|---|---|---|---|---|---|---|---|---|---|---|
actionText (SPA API) |
apiDoc |
Sets the text value of the HTML element that was clicked to start a browser interaction. |
|
SPA API call with browser to set the name and trigger of a browser interaction that is not a route change or URL change. |
|
never |
newrelic.interaction().actionText(string $value)
Sets the text value of the HTML element that was clicked to start a browser interaction.
-
Browser Pro+SPA agent (v1099 or higher)
-
If you're using npm to install the browser agent, you must enable the
spa
feature when instantiating theBrowserAgent
class. In thefeatures
array, add the following:import { Spa } from '@newrelic/browser-agent/features/spa'; const options = { info: { ... }, loader_config: { ... }, init: { ... }, features: [ Spa ] }
For more information, see the npm browser installation documentation.
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.
<th>
Description
</th>
</tr>
Parameter |
---|
`$value`
|
This method returns the same API object created by interaction()
.
document.getElementById('subscribe').addEventListener('submit', () => {
newrelic.interaction().actionText('Create Subscription');
createSubscription();
});