How I make INFOLINKS_ON and INFOLINKS_OFF work on my website

Many bloggers use Infolinks as a monetization tool for their websites. Since it is easy to implement, I had Infolinks enabled on my website as well.

Out of the box, the javascript codes from Infolinks scan an entire webpage for opportunities to create links to advertisers' website.

However, there can be areas of your website that you do not want Infolinks to convert into links. Examples could be the paragraph that describes your page or the paragraph that talks about a product that you are selling from your website.

This post describes what I did on my website to control Infolinks inText ads generation.

<!--INFOLINKS_OFF--> and <!--INFOLINKS_ON--> does not work on my website

Google brought me to Infolinks' page on restricting inText ads. That page suggests that I include the Infolinks off tag:

<!--INFOLINKS_OFF--> 

to turn off the infolinks script and the Infolinks on tag:

<!--INFOLINKS_ON-->

to turn the Infolinks script back on again.

This suggests that Infolinks script scan webpages from top to bottom; when it encounters the off tag (INFOLINKS_OFF), it will not place any inText ads until it encounters the on tag (INFOLINKS_ON) again.

As an example, suppose I want to prevent Infolinks from creating inText ads on the description of my site, my html code for my description section should be as follows:

<!--INFOLINKS_OFF-->
<div id="aboutTechcoilSection">
	<h2>About Techcoil</h2>
	<p>
	Technologies coil to form a greater whole, thereby facilitating the exchange of information between people. 
	That was how Techcoil was named. 
        </p>
	<p>
	Launched in 2010, Techcoil was designated to serve as a memory lane, as well as a testing ground for web related technologies.
	</p>
	<p>
	We have articles to some technical problems, book recommendations for reading pleasure and self-improvement and some tools to help make some work a little bit faster.
	</p>
</div>
<!--INFOLINKS_ON-->

To my dismay, this does not work for me; inText ads were still appearing in my "About Techcoil" section.

The HTML codes that helped me control where Infolinks place inText ads for my website

My Aptana IDE highlighted to me that

<!--INFOLINKS_OFF--> 

and

<!--INFOLINKS_ON-->

are not proper HTML comments. Hence, I decided to modify the tags by adding an extra spacing between the dashes that surround "INFOLINKS_OFF" and "INFOLINKS_ON" string literal:

<!-- INFOLINKS_OFF -->
<!-- INFOLINKS_ON -->

making the resultant HTML codes to turn off inText ads generation at my "About Techcoil" section looks like the following:

<!-- INFOLINKS_OFF -->
<div id="aboutTechcoilSection">
	<h2>About Techcoil</h2>
	<p>
	Technologies coil to form a greater whole, thereby facilitating the exchange of information between people. 
	That was how Techcoil was named. 
        </p>
	<p>
	Launched in 2010, Techcoil was designated to serve as a memory lane, as well as a testing ground for web related technologies.
	</p>
	<p>
	We have articles to some technical problems, book recommendations for reading pleasure and self-improvement and some tools to help make some work a little bit faster.
	</p>
</div>
<!-- INFOLINKS_ON -->

Sure enough, once I deployed the code changes, I never saw inText ads appearing in my "About Techcoil" section again.

About Clivant

Clivant a.k.a Chai Heng enjoys composing software and building systems to serve people. He owns techcoil.com and hopes that whatever he had written and built so far had benefited people. All views expressed belongs to him and are not representative of the company that he works/worked for.