All Collections
Ad Units and Code Snippets
Adding Adsterra ads to a php-based website
Adding Adsterra ads to a php-based website
Victoria V avatar
Written by Victoria V
Updated over a week ago

💡 PHP is a server-side language you can use to build your website. When someone opens your website, their browser sends a request to your server, where PHP code generates HTML and sends it back to the browser.

In practice, it means that your website files are structured a bit differently. Here’s an example:

Here we have a file for each webpage element: header, footer, sidebar, and so on. To access these files, you can use any FTP client (we’ll be using https://onlineftp.ch/). FTP (File Transfer Protocol) allows to you to access the files stored on a server or another computer.

The goal of this article is to give you a general idea of how to add Adsterra ads to your PHP website, so we’ll use a simple generic website.

Static Banners

We’ll add a leaderboard Banner to the page header to make sure it is on every page. To do that, we’ll edit the header.php file.

This file usually has the <head> of the page and the opening <body> tag.

Right below the opening <body> tag, we have our website menu, formatted as HTML:

If we add the static Banner script right below navigation:

Native Banners

Let’s say we’d like to add a 4 by 1 Native Banner in the sidebar, right below our social links.

We’ll need our sidebar.php file for that:

To make sure we do not interfere with any other elements, we added our script between a closing </section> tag and another opening <section> tag.

Social Bar

Social Bar is placed above the closing </body> tag, so we’ll need footer.php file:

Popunder

We recommend adding a Popunder code right above the closing </head> tag. In our case, it is in the header.php file:

Please bear in mind that your website might be slightly different, so please adjust your steps accordingly.

💡 Note that we do not provide ads.txt files, as our advertisers do not require them.

If you still need it, you can contact us to request the required details and create the file on your own. We'll be glad to share the needed data with you!

Did this answer your question?