You will find that the #exec cgi SSI tag should suffice in most cases; having a relation setup which just uses the relative webpage location on your server will have the AMS match up directly with the page containing the SSI tag.
However, you may find that this does not work for your particular situation. The most common cause for this would be that your website is being "Virtually Hosted" by another website which has the AMS system installed. In a case like this, the relative page urls may not match up directly, resulting in the need for the #exec cmd version to be used.
Another case where the #exec cmd version must be used would be when you want to have multiple AMS tags used on a single page, where each call must produce a unique adbar. Simply using the #exec cgi version in this case won't suffice because there is the possibility that both calls will produce the same adbar. There is no way around that using this version. However, you can
use the shell version to accomplish this. To do this, you would create two relations, each with a unique set of ads that may be displayed. Each relation should then have a unique rule defined for it, and each AMS call should have one of the rules passed. For example suppose you have two relations set up, one using the rule AD:USE_RULE1 and the other using the rule AD:USE_RULE2. Adding the following tags will produce two unique adbars on this page:
<!--#exec cmd="/usr/local/etc/httpd/cgi-bin/ams_shell.pl AD:USE_RULE1"-->
<!--#exec cmd="/usr/local/etc/httpd/cgi-bin/ams_shell.pl AD:USE_RULE2"-->