User-Defined Variable

The User-Defined Variable (UDV) is a Visit-level custom variable in Angelfish.  The UDV can be assigned via JavaScript on your website (AGF Tracking Method only), or it can be assigned with an Advanced filter during processing (all Tracking Methods).

AGF SYNTAX
agf.setUserDefined('value')

Assign the UDV  with the agf.setUserDefined() method - simply call the method within a Page and replace the 'value' with a static value or a variable. The agf.setUserDefined() method can be called from any JavaScript event, e.g. onClick. The UDV only stores one value per visit, and retains the most recent value assigned.

The agf.setUserDefined() method ONLY assigns a value to the UDV. In order for the UDV to be associated with a visit, the agf.pageview() method must be called after the UDV has been assigned.

Examples


Lead Form:

This example assigns a UDV value of "lead" to Visits that fill out a form on your website.  Add the agf.setUserDefined() method to the Tracking Code reference on the form's thank you page:


<script type="text/javascript" src="/angelfish.js"></script>
<script type="text/javascript">
    agf.setUserDefined('lead');
    agf.pageview();
</script>
 
 
OnClick:

This example assigns a UDV value of "ad-click" to Visits that click an ad, like a banner or a text link.  Add the agf.setUserDefined() method to the ad's anchor tag with an onClick:

onclick="agf.setUserDefined('ad-click');"
Creation date: 4/18/2022 7:18 PM      Updated: 6/27/2022 1:07 PM