Hướng dẫn ẩn quảng cáo của GA đối với visitor ở một vài nước

Dùng htaccess files

bạn vào trang này :
http://www.countryipblocks.net/
Chọn nước cần block sau đó tạo thành 1 file .htaccess

cách làm như sau

ví dụ tên miền của bạn là http://tenmien.com bạn tạo 1 thư mục là bandip
http://tenmien.com/bandip/ <== đặt file .htaccess vào trong thư mục này

vào trang này http://accessify.com/tools-and-wizards/developer-tools/html-javascript-convertor/
Tạo mã code adsense của bạn thành file .js ví dụ google.js

document.write(" <script type=\"text\/javascript\"><!--");
document.write(" google_ad_client = \"pub-9790413511118***\";");
document.write(" \/* 200x90 links *\/");
document.write(" google_ad_slot = \"5645502***\";");
document.write(" google_ad_width = 200;");
document.write(" google_ad_height = 90;");
document.write(" \/\/-->");
document.write(" <\/script>");
document.write(" <script type=\"text\/javascript\"");
document.write(" src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">");
document.write(" <\/script>");


để hiện ads của google bạn dùng : <script src ='http://tenmien.com/bandip/google.js'></script>

Những nước nào bị block sẽ ko truy cập được vào file js kia và ads sẽ ko hiện

Nhận xét

Bài đăng phổ biến từ blog này

Phần II - System Preferences - Chỉnh cấu hình hệ thống

Bài thuốc tự chế “vĩnh biệt” bệnh xoang không tốn tiền

Phần I - Những Cái Nhìn Đầu Tiên