Mark affiliate links in your content using CSS

As a German blogger, there are some things you should be aware of. One of them is the “Gesetz gegen den unlauteren Wettbewerb” (law against unfair business practices). If you run a business and you think, that someone is taking advantage by not following some rules, you might be able to sue them. Even if you only have a “personal blog”, chances are very high, that it’s not totally “private”. Some bloggers don’t want to have advertisements on their blog, but they participate in some affiliate programs and “just” place some links. But this is considered advertisement as well and must therefore be marked as such.


As I am not a lawyer, the text of this blog post may not be completely legally founded. Therefore, this blog post will only give you a technical solution, which might not be enough legally. If you have any doubts, please consult a lawyer, you can verify your specific situation.

When to mark affiliate links

Many bloggers who use some sort of affiliate program do it in a correct way. They clearly mark those links as such or the affiliate placement itself is clearly recognizable as advertisement (like the Host Europe affiliate program ads, I have on this blog). But some might not be easily recognizable. In Germany, any media that gives the impression of neutrality, must clearly mark any links or even whole posts (sponsored posts). A simple note like “some links on my blog might be affiliate links” is not enough. But how can you mark them? A very simple solution would be adding the text “(advertisement)” after every such link. But chances are, that a blogger forgets it.

Marking links using CSS

As placing affiliate links and updating their targets is usually not done manually but through plugins, we can utilize that to automate the marking of such links. There are many out there and as I don’t use any of them, let’s take ThirstyAffiliates as an example. They say, that they are an “affiliate link management & link cloaking tool”. And this cloaking does not really work well with the German law, as it’s even harder to recognize an affiliate link from its URL. The plugin is taking the ugly links and convert them to some pretty ones. They might look something like this:

The term “recommends” in the URL does not really tell the user, that money is involved. And as the plugin has no option to add any marking to the link, we have to find an easy solution. After someone asked me to help him finding one, I came up with the following CSS:

a[href*="/recommends/"]:after {
	content: " (affiliate link)";

As the example plugin is always using the same static word in its URLs, we can simply use this in a CSS selector and then add some additional text after the link text. If this solution will be legally enough for marking a link as an advertisement is a different story. So better ask a founded lawyer about this.


I hope that this blog post could help you a bit to understand, why marking an affiliate link as such, is very important. At least if you do business in Germany (or if you are a “no purely” personal blog). I would really like to see the plugins to offer an option to mark affiliate links. This will protect the users of their plugin from sues. But maybe the laws in the countries of the plugin programmers are not as strict as in Germany. Then we as a community should ask them to implement such an option.

I do not use any affiliate links on my blog, but I know many of my readers do. And not all of them always mark every link. How about you? Do you use affiliate links? And how do you mark them? Or why not? I would really be interested in your comments.

Posted by

Bernhard is a full time web developer who likes to write WordPress plugins in his free time and is an active member of the WP Meetups in Berlin and Potsdam.

2 comments » Write a comment

  1. Hi Bernhard, this a great hint. We are also based in Germany and just starting to monetize our blog One part of it is affiliate marketing.

    I’ve found a German lawsuit where (if I understood it right) marking an affiliate link with the word “sponsored” didn’t satisfy the judge: Another lawsuit is referred (BGH GRUR 2014, 879), effectively stating that a German language site must use a German term, AND the term “sponsored” being too vague.

    IMO marking an affiliate link with the words “affiliate link” is the least vague option – but also not German. Not an easy terrain :-/

    • Hi Andreas,

      yeah the German law is so complex in some fields. And I also know these cases with sponsored posts. But I think most German now the word sponsor and associate if with money, but not too many know, what am affiliate is.

Leave a Reply

Your email address will not be published. Required fields are marked *