title | type | shortDescription | tags | metaDescription | redirects | freshnessValidatedDate | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Increment session attribute count |
apiDoc |
Increments the count of a session attribute. Overwrites previous value and type each time called. |
|
Mobile app monitoring API used to increment a custom session attribute value. |
|
2023-07-20 |
</TabsBar>
<TabsPages>
<TabsPageItem id="android">
NewRelic.incrementAttribute(string $name[, float $value])
NewRelic.incrementAttribute(name: String!, value : Double)
Increments the count of an attribute. Overwrites its previous value and type each time it is called.
When passed with only a name value, this method increments the count for the specified attribute by 1. If the attribute does not exist, it creates the attribute with a value of 1. When passed an optional float value, it increments the count for the specified attribute by the float value.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute.
</td>
</tr>
<tr>
<td>
`$value`
</td>
<td>
`float`
</td>
<td>
Optional. The attribute is incremented by this float value.
</td>
</tr>
Parameter |
---|
`$name` |
Returns true
if recorded successfully, or false
if not.
Here's an example to increment the count for the specified attribute by 1. If the attribute does not exist, it creates the attribute with a value of 1:
boolean incremented = NewRelic.incrementAttribute("rate");
val incremented = NewRelic.incrementAttribute("rate")
Here's an example to increment the count for the specified attribute by the float value amount:
boolean incremented = NewRelic.incrementAttribute("rate", 9999.99, false);
val incremented: Boolean = NewRelic.incrementAttribute("rate", 9999.99)
</TabsPageItem>
<TabsPageItem id="ios">
incrementAttribute:(NSString*)name value:(NSNumber*)amount;
NewRelic.incrementAttribute(string $name[, float $value])
Increments the count of a session attribute. Overwrites previous value and type each time called.
When passed with only a name value, this method increments the count for the specified session attribute by 1. If the attribute does not exist, it creates the attribute with a value of 1. When passed an optional float value, it increments the count for the specified attribute by the float value.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute to increment.
</td>
</tr>
<tr>
<td>
`amount`
</td>
<td>
`number`
</td>
<td>
Optional. The amount to increment the attribute by.
</td>
</tr>
Parameter |
---|
`name` |
Returns true
if the event is recorded successfully, or false
if not.
Here's an example to increment the count for the specified session attribute by 1. If the attribute does not exist, it creates the attribute with a value of 1:
BOOL incremented = [NewRelic incrementAttribute@"rate"];
Here's another example to increment the count for the specified session attribute by the amount specified in NSNumber*
:
BOOL incremented = [NewRelic incrementAttribute:@"rate" value:@1];
Here's an example to increment the count for the specified session attribute by 1. If the attribute does not exist, it creates the attribute with a value of 1:
let incremented = NewRelic.incrementAttribute("rate")
Here's another example to increment the count for the specified session attribute by the amount specified in NSNumber!
:
let incremented = NewRelic.incrementAttribute(name: String!, value: NSNumber!)
</TabsPageItem>
<TabsPageItem id="capacitor">
incrementAttribute(options: { name: string; value?: number; }) => void
Increments the count of an attribute with a specified name. Overwrites its previous value and type each time it is called. If the attribute does not exists, it creates a new attribute. If no value is given, it increments the value by 1.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute to increment.
</td>
</tr>
<tr>
<td>
`value`
</td>
<td>
`number`
</td>
<td>
Optional. The amount to increment the attribute by.
</td>
</tr>
Parameter |
---|
`name` |
Returns true
if the event is recorded successfully, or false
if not.
NewRelicCapacitorPlugin.incrementAttribute({ name: 'CapacitorAttribute', value: 15 })
</TabsPageItem>
<TabsPageItem id="cordova">
incrementAttribute(name: string, value?: number): void;
Increments the count of an attribute with a specified name. Overwrites its previous value and type each time it is called. If the attribute does not exists, it creates a new attribute. If no value is given, it increments the value by 1.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute to increment.
</td>
</tr>
<tr>
<td>
`value`
</td>
<td>
`number`
</td>
<td>
Optional. The amount to increment the attribute by.
</td>
</tr>
Parameter |
---|
`name` |
Returns true
if the event is recorded successfully, or false
if not.
NewRelic.incrementAttribute('CordovaCustomAttrNumber');
NewRelic.incrementAttribute('CordovaCustomAttrNumber', 5);
</TabsPageItem>
<TabsPageItem id="maui">
RecordCustomEvent(string eventType, string eventName, Dictionary<string, object> attributes): bool;
Increments the count of an attribute with a specified name. Overwrites its previous value and type each time it is called. If the attribute does not exists, it creates a new attribute. If no value is given, it increments the value by 1.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute to increment.
</td>
</tr>
<tr>
<td>
`value`
</td>
<td>
`number`
</td>
<td>
Optional. The amount to increment the attribute by.
</td>
</tr>
Parameter |
---|
`name` |
Returns true
if the event is recorded successfully, or false
if not.
// Increment by 1
CrossNewRelic.Current.IncrementAttribute("MAUINumAttr");
// Increment by value
CrossNewRelic.Current.IncrementAttribute("MAUINumAttr", 12.3);
</TabsPageItem>
<TabsPageItem id="flutter">
incrementAttribute(name: string, value?: number): void;
Increments the count of an attribute with a specified name. Overwrites its previous value and type each time it is called. If the attribute does not exists, it creates a new attribute. If no value is given, it increments the value by 1.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute to increment.
</td>
</tr>
<tr>
<td>
`value`
</td>
<td>
`number`
</td>
<td>
Optional. The amount to increment the attribute by.
</td>
</tr>
Parameter |
---|
`name` |
Returns true
if the event is recorded successfully, or false
if not.
NewrelicMobile.instance.incrementAttribute("FlutterCustomAttrNumber");
NewrelicMobile.instance.incrementAttribute("FlutterCustomAttrNumber",value :5.0);
</TabsPageItem>
<TabsPageItem id="react">
incrementAttribute(name: string, value?: number): void;
Increments the count of an attribute with a specified name. Overwrites its previous value and type each time it is called. If the attribute does not exists, it creates a new attribute. If no value is given, it increments the value by 1.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute to increment.
</td>
</tr>
<tr>
<td>
`value`
</td>
<td>
`number`
</td>
<td>
Optional. The amount to increment the attribute by.
</td>
</tr>
Parameter |
---|
`name` |
Returns true
if the event is recorded successfully, or false
if not.
NewRelic.incrementAttribute('RNCustomAttrNumber');
NewRelic.incrementAttribute('RNCustomAttrNumber', 5);
</TabsPageItem>
incrementAttribute(string name, float value = 1) : bool;
Increments the count of an attribute with a specified name. Overwrites its previous value and type each time it is called. If the attribute does not exists, it creates a new attribute. If no value is given, it increments the value by 1.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute to increment.
</td>
</tr>
<tr>
<td>
`value`
</td>
<td>
`number`
</td>
<td>
Optional. The amount to increment the attribute by.
</td>
</tr>
Parameter |
---|
`name` |
Returns true
if the event is recorded successfully, or false
if not.
// Increment by 1
NewRelicAgent.IncrementAttribute('UnityCustomAttrNumber');
// Increment by value
NewRelicAgent.IncrementAttribute('UnityCustomAttrNumber', 5);
</TabsPageItem>
incrementAttribute(FString name,double value): void;
Increments the count of an attribute with a specified name. Overwrites its previous value and type each time it is called. If the attribute does not exists, it creates a new attribute. If no value is given, it increments the value by 1.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute to increment.
</td>
</tr>
<tr>
<td>
`value`
</td>
<td>
`number`
</td>
<td>
The amount to increment the attribute by.
</td>
</tr>
Parameter |
---|
`name` |
// Increment by 1
UNewRelicBPLibrary::incrementAttribute("Unreal Double",5.0);
</TabsPageItem>
<TabsPageItem id="xamarin">
IncrementAttribute(string name, float value = 1) : bool;
Increments the count of an attribute with a specified name. Overwrites its previous value and type each time it is called. If the attribute does not exists, it creates a new attribute. If no value is given, it increments the value by 1.
<th width={200}>
Type
</th>
<th>
Description
</th>
</tr>
<td>
`string`
</td>
<td>
Required. The name of the attribute to increment.
</td>
</tr>
<tr>
<td>
`value`
</td>
<td>
`number`
</td>
<td>
Optional. The amount to increment the attribute by.
</td>
</tr>
Parameter |
---|
`name` |
Returns true
if the event is recorded successfully, or false
if not.
// Increment by 1
CrossNewRelicClient.Current.IncrementAttribute("XamarinNumAttr");
// Increment by value
CrossNewRelicClient.Current.IncrementAttribute("XamarinNumAttr", 12.3);
</TabsPageItem>
</TabsPages>