구글 애드센스 특정 페이지에서 작동 안하게 수정 > 코딩 스토리

구글 애드센스 특정 페이지에서 작동 안하게 수정

본문

<script>
const blockedPaths = ['/bbs/profile.php', '/bbs/follow.php', '/bbs/memo.php']; // 구글 애드센스 차단할 페이지 경로
if (blockedPaths.includes(window.location.pathname) && window.location.pathname !== '/index.php') { //이 코드 자체가 작동을 멈출 경로
   const adsenseScripts = document.querySelectorAll('script[src*="pagead2.googlesyndication.com"]');
   adsenseScripts.forEach(script => script.parentNode.removeChild(script));
}
</script>


*사용 결과 이 코드가 작동을 멈츌 경로를 설정해두지 않으면, 이 코드가 있는 페이지의 최신글 출력 부분이 프로필 url, 프로필 이미지url과 게시글 연결 url이 http로 바뀌는 오류 발생함

좋아요36 이 글을 좋아요하셨습니다
url 복사 카카오톡 공유 라인 공유 페이스북 공유 트위터 공유

카테고리 분류 학습 시스템 (총 0개 학습됨)

예측 카테고리: 정치 (랜덤 - 학습 데이터 없음)

이 분류가 맞나요? 학습시켜주세요!

등록된 댓글이 없습니다.

  • RSS
  • _  글쓰기 글쓰기
전체 302건
게시물 검색

접속자집계

오늘
1,184
어제
3,897
최대
42,418
전체
939,412