教学-如何在OpenCart里加入谷歌广告代码(Google Adsense Code)

  1. 打开Google Adsense后台,获取广告代码:https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
  2. 加入代码:首先打开OpenCart后台,按下列菜单进入模块

    [Extensions]->[Extensons]->在右侧下拉菜单里选择[Modules]->HTML->GoogleAdsense


     



     

    3,显示代码:在后台点开 [Design]->[Layouts]->[Product]->自己选择要添加广告的位置->完成


     

    4.进入网站的托管后台,按下列路径找到文件:header.twig

    cpanel ——> public_html>catalog>view>theme>(default or what ever you use themes)>template>common>header.twig

    邮件点击编辑,在<head>….</head>之间假如你的Google Adsense代码<script data-ad-client=”ca-pub-7580415969318xxx” async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>. 保存。           

    First you must download Ads.txt from your Google Adsense account, then upload into your domain website.
    Then you must add your Google Adsense script
    <script data-ad-client=”ca-pub-5069328492041911″ async src=”https://pagead2.googlesyndication.com/p … “></script>
    on your own website at your cpanel ——> public_html>catalog>view>theme>(default or what ever you use themes)>template>common>header.twig …..you must add your Adsense script between <head>….</head>.
    After that you must wait for 24 hours to let Google Adsense learning your website structure for the best ads positions, next morning you Google Adsense will be active on your website.
    Trust me, I already have same problem as you and resolved. I hope you success to modify your Opencart (DO NOT FORGET TO BACKUP YOUR OPENCART FIRST, BEFORE MAKE ANY MODIFICATIONS).              

-完-