If you started a forum with Xenforo and want to connect your forum with Google Adsense but don’t know how then this post can save you lots of time.
Here is the step-by-step solution to connect Xenforo with Google Adsense.
Let’s get straight to the solution:
The solution contains 2 parts:-
1) To get your code by adding your site to AdSense and 2) Adding that code in xenforo.
Get your Google Adsense code to connect to your forum.
- Go to your Google Adsense account.
- Go to the site section on the left
3. Click on Add Site at the top right.
4. Enter your Forum Url and click save and continue.
5. After clicking Save and continue you will get your Google Adsense code to connect our forum with google AdSense and allow them to place ads in any suitable place. Copy this code.
Copy the code by clicking the copy button.
Adding Adsense Code in Xenforo Template
6) Now login to your Xenforo Admin Panel. There are options on the left side, Go to Appearance – Template. This section contains all the blocks by which your forum is basically created.
7) Use the search option to filter these templates. Search the query “Page”. This shall show you all the templates containing the word “page”. We are concerned with the template named “PAGE_CONTAINER”. Select to go to the editing page of the template.
Below is the sample look of the page container editing screen.
8) As instructed on the Google Adsense page, you should add your code between <head> </head> tags. Now scroll down until you reach </head> usually at the 60-70 line.
9) Now add your Adsense code before the </head> tag. See the below image for clarity.
Now, if your forum uses only one style. You can simply click the “save and exit” button and return to your AdSense account and click “Request review”. But if your site uses more than 1 style you need to add your codes in all the styles. Click save, this will successfully add the code in the 1st style.
Now change the style by using the style selector at the top.
Now repeat the same steps and add your code just before the </head> tag for all the styles.
Once you add your codes in each style and saved it, go to your Adsense page and click the “Request review” button. Now, you have successfully connected your Xenforo forum with Google Adsense. Wait for Google to review your site. Once approved, you will be able to add ads to your forum.
Now if you don’t want auto ads in Xenforo, you can use some addons to place manual ads.