How to place In-feed ad code

  • Andr989
    Inactive member
  • Topic Author
  • New Member
  • New Member
More
10 months 3 weeks ago #51067 by Andr989
I'm attempting to integrate Google AdSense's in-feed ad code within the loop that generates the content feed on the homepage.  While I've come across general guidelines and examples for adding the ad code within the loop, I'm finding it a bit challenging to locate the exact loop structure within the template files. I understand that templates may vary in their organization, and I would greatly appreciate it if you could provide me with some guidance or clarification on how to locate and modify the loop for this purpose.  Could you please point me in the right direction or provide some insights on how I can effectively integrate the in-feed ad code within the content loop of the homepage?

Best regards

Please Log in to join the conversation.

  • milos
    Support Staff
  • Moderator
  • Moderator
More
10 months 3 weeks ago #51068 by milos
Replied by milos on topic How to place In-feed ad code
Hello,

If you need to add the code in the <head> section of your website, then it's recommended to do so from the template options. You can access it from System > Site Template Styles > News Portal > Custom > <head> (last pane).

If you must edit the main template file, you can edit the file /templates/sparky_framework/index.php. You will see the entire page structure there (both <head> and <body> sections). Make sure you created a backup before editing this file because if this file is improperly formatted, your website will not work.

Regards,
Milos

Please Log in to join the conversation.

  • Andr989
    Inactive member
  • Topic Author
  • New Member
  • New Member
More
10 months 3 weeks ago #51069 by Andr989
Thank you for your prompt response. However, I wanted to clarify that my goal is to include the in-feed ads among the articles on the homepage and categories. Unfortunately, I've only managed to display the ads either before or after the article feed (adding the code after or before <jdoc:include type="component" />), but not within it. I would like the ad to appear like this :

https://blogger.googleusercontent.com/img/a/AVvXsEieXPuIhECuTezP7uqtU5uAJgCQJI9BtGECpjo3eoPgjgL1vorgSoEhy1yYTEFAlYkGBiX9hPMBSl9J7p5CV61WyBjb8RttNVmQDEzOhJFPkNfjRHrGafwhTm98RuQ923mUnfWEwOVCrQPZOaqKq9-M5HAeBp3IPbm8VOPaGVYqebWwnrX67fMP5bgO

Once again, I appreciate your assistance with this matter, and I look forward to your response. 

Please Log in to join the conversation.

  • milos
    Support Staff
  • Moderator
  • Moderator
More
10 months 3 weeks ago #51070 by milos
Replied by milos on topic How to place In-feed ad code
Hello,

Then you should insert the code in the article itself, from Joomla. You don't need to edit any files. If you are using our Sparky Page Builder as a content editor, you can insert the code using the Custom HTML block: www.hotjoomlatemplates.com/sparky-page-b...n/blocks/custom-html

But if you use the default Joomla editor or another editor, the code may be cut off or damaged after saving. So, in this case, you must disable the editor from the global configuration before adding the code.

Regards,
Milos

Please Log in to join the conversation.

  • Andr989
    Inactive member
  • Topic Author
  • New Member
  • New Member
More
10 months 3 weeks ago #51072 by Andr989
I appreciate your continued support. However, integrating the code within an article isn't the optimal solution I'm pursuing. My objective is to seamlessly showcase the in-feed ads amidst the articles on both the homepage and within the category sections. Specifically, the previews of 20 articles are presented on the homepage and within various menu categories, and it's among these previews that the Google In-feed Ads should seamlessly blend, rather than within the extended articles where display ads are typically utilized instead of in-feed ads.

Regards,

Please Log in to join the conversation.

  • milos
    Support Staff
  • Moderator
  • Moderator
More
10 months 3 weeks ago #51074 by milos
Replied by milos on topic How to place In-feed ad code
Hello,

I am not sure what you are trying to achieve, but I gave you all the available possibilities. So, any code snippet that you get from Google (or any other provider) can be integrated:

1. Globally for the entire website, in <head> or <body> section, by editing the file /templates/sparky_framework/index.php

2. Separately for each of the articles, by adding the code snippet in the article content itself, from Joomla, without editing any template files.

Regards,
Milos

Please Log in to join the conversation.

Time to create page: 0.138 seconds
Powered by Kunena Forum