Skip to content

Instantly share code, notes, and snippets.

@AbhishekGhosh
Last active September 29, 2021 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhishekGhosh/f6e03380bd7085b2903f429679a6b498 to your computer and use it in GitHub Desktop.
Save AbhishekGhosh/f6e03380bd7085b2903f429679a6b498 to your computer and use it in GitHub Desktop.
Ad Invalid Click Protector code
// Install https://wordpress.org/plugins/ad-invalid-click-protector/
<?php
if( aicp_can_see_ads() ) {
// This part will show ads to your non-banned visitors
$adCode = '<div class="aicp">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- responsive_box -->
<ins class="adsbygoogle right-floating-ad"
style="display:block"
data-ad-client="ca-pub-8996933744651682"
data-ad-slot="5609641037"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>';
return $adCode;
} else { // show custom text/image like below
return '<div class="error">You have been blocked from seeing ads.</div>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment