How to assign visits of a web page to a particular affiliate and campaign?

You can use the following type of click tracking code in the particular webpage:
<script type="text/javascript"><!--
document.write(unescape("%3Cscript id='pap_x2s6df8d' src='" + (("https:" == document.location.protocol) ? "https://" : "https://") +
"URL_TO_PostAffiliatePro/scripts/trackjs.js' type='text/javascript'%3E%3C/script%3E"));//-->
<script type="text/javascript"><!--
try {
var AffiliateID='Affiliate ID goes here';
var BannerID='Banner ID goes here';
} catch (err) { }

You would use there ID of a banner assigned to the campaign under which you want to track the click and for which you want to create the cookies. It is important for the way how campaigns are recognized in PAP during tracking.
Of course, if you wish to set only the 'affiliate' for the click and created cookie, then do not use the var BannerID line at all.
OR  check out the site replication feature which has similar effect and adds this type of click tracking code with already defined affiliate to all the replicated pages.
Note: if you wish to learn more about other advanced variables and functions you can use in the click tracking code then check the last paragraph of our article detailing click tracking code.