Passing parameters for forms

When either a form or external link is invoked, sometimes you need to pass data that is known to the personalization. For instance, the customer identifier or as in the previous example with Google, the query might be computed during personalization. In this case, the link is produced with parameter replacement syntax as shown in the following example. The example creates a link using the users preferred sport, with the link naming it as a search for that topic:

<a href=www.google.com?q=${extensiontable.favoritesport}>Search for ${extensiontable.favoritesport?cap_first</a>

If the user’s favorite sport is hockey, the example will produce this output:

<a href=”www.google.com?q=hockey”>Search for Hockey</a>

You can use the same technique for links to an internal form. Consider the following example:

<a href=”${form(‘user preferences‘,“extensiontable.favoritesport”)}”>View Preferences</a>

This form invocation formats and generates the URL that will point to the form processor. The parameters are encoded in the resulting URL.

The field names in the form method are specified as string scalars. This indicates to the form method that:

  1. The value for the field extensiontable.favoritesport must be obtained from the recipient record.

  2. If the actual field name for extensiontable.favoritesport maps to the database field FAVORITE_SPORT, a field named FAVORITE_SPORT is sent with this value and made available to the form processor. With this information, the form processor can personalize with the given name.

A variation of the above mentioned method of passing fields by name is to pass the field name with the provided value. Consider the following example:

<a href=”${form(‘user preferences’, ’FAVORITE_SPORT=soccer’)}”>View Preferences</a>

In this case, a field name is passed with an equals sign and the required value. This name can be used in the form processor to retrieve the value of the field. You do not need to specify the data source or column aliases since the field expected in the form processor is known. This skips the step of retrieving the field name from the record, but still sends the parameter to the form with the given field name.

You can use more complex expressions in the creation of links. For example, you can use string concatenation expressions to compute the value:

<a href=”${form(‘user preferences‘,’FAVORITE_SPORT=’+profile.sport)}”>View Preferences</a>

Although the form method can be placed in the link table as part of the link URL, its capabilities in a link URL are limited.

Note the use of apostrophes in the previous examples. This is a best practice when using anchors, since the href for the anchor itself is enclosed in double quotes. This will be important with implicit click tracking, described in Click Tracking.

Next steps

Click Tracking