• /
  • EnglishEspañol日本語한국어Português
  • EntrarComeçar agora

actionText (SPA API)

Syntax

newrelic.interaction().actionText(string $value)

Sets the text value of the HTML element that was clicked to start a browser interaction.

Requirements

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.

Dica

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

$value

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();
});
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.