Affiliate Code

The affiliate code is used to track conversions and clicks in affiliate marketing. The code is incorporated into the advertising material on the affiliate's website.


Affiliate marketing is an important aspect of online advertising. Whereas advertising programs, such as Google Ads, carry out their computation based on clicks, affiliates only receive a commission when the user has performed the previously agreed conversion after the click. This can either be a lead or a purchase (sale).

In search engine advertising it is irrelevant where the customer comes from, because this is easily identified (e.g., the SERP of the respective search engine provider), but clear allocation is important in affiliate marketing so that commissions can be paid after a conversion. This is ensured using the affiliate code.


Affiliate codes can be embedded in text links, image links, or banner links. Videos or other types of files can also be marked with a code that simplifies the tracking. Affiliate networks also assign affiliate IDs that are found in the corresponding tracking code.

Such a code usually contains the following components:

  • Link target:
    The advertisement’s target URL is added here.
  • Affiliate ID:
    This is the individual number through which every publisher/affiliate can be identified.
  • Advertisement ID:
    This shows the advertisement that led to the conversion.
  • Image URL:
    For banner advertisements, this is the URL used to access AdServer or the server of the advertising partner.

Example of an affiliate code[edit]

An affiliate code may look like this:

<script type="text/javascript" src=""></script>
 <script type="text/javascript">

Affiliate codes are usually embedded using a small JavaScript, but they can also be added in HTML. In addition to images and text, CSV files and RSS feeds can also be used to integrate the code in a website. Through CSV lists, promotional material can be displayed dynamically on the respective publisher websites such as Amazon product advertisements.

Practical implementation[edit]

In order to increase the number of conversions and, hence, the amount of paid commissions, it is important to select appropriate advertisement material for affiliates. Here, optimizing the link target can also be advantageous. For example, a deep link that points directly to a special offer of the merchant should be used.

For partner programs, diverse advertisement material is mostly provided by the merchants. The higher the number of advertisements and the more attractive their structure is, the more likely it is that affiliates will use them and sign up for the respective program.