tracking - SetMetric 

Page / - last modified by Outhman Moustaghfir on 2024/01/25 12:20 

SetMetric 
last modified by Outhman Moustaghfir
on 2024/01/25 12:20

Table of Contents
Description
Syntax
Parameters
Example
Notes

Description
The SetMetric function is used to set a metric in XSLT. It allows you to specify the name of the metric, its alias (projection), and the desired value.
Syntax
 
<xsl:value-of select="ixf:SetMetric(metricName, projection, value)"></xsl:value-of>
Parameters
•	metricName: The name of the metric to be set. (Required)
•	projection: The alias of the metric. (Required)
•	value: The value to be assigned to the metric. (Required)
Example
Consider the following example where the metric "TotalSales" with an alias "SalesAlias" is set to the value 500:
 
<xsl:value-of select="ixf:SetMetric('TotalSales', 'SalesAlias', '500')"></xsl:value-of>
This will set the metric named "TotalSales" with the alias "SalesAlias" to the value 500.
Notes
•	All parameters (metricName, projection, and value) are required.
•	setMetric function will add or subtract a value from the previous result. For example, if you input 10 and there was already a value of 500, the result will be 510.
•	Adding 1 will add 1 to the previous value.
•	- 1 will subtract 1 from the previous value."