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.
Example 1 - Lead Form:
To assign a UDV value of "lead" to visits that fill out a form on your website, add the agf.setUserDefined() method to the tracking code on the form's thank you page:
Example 2 - Ad Click:
To assign a UDV value of "ad-click" to visits that click an advertisement (e.g. banner or text link), add the agf.setUserDefined() method to the ad's anchor tag with an onClick: