marklcfc Posted October 3, 2020 Share Posted October 3, 2020 (edited) I have some code I used for a few years which displayed a message to users using adblock. It doesn't work anymore. Can anyone help fix it? It wasn't used an as official hook, just placed into globaltemplate and a simple .js file. Edited October 3, 2020 by marklcfc Link to comment
marklcfc Posted October 7, 2020 Author Share Posted October 7, 2020 These are the details if anyone can help. See the attached a .js file. Then I put this in my globalte <script type="text/javascript" src="/advertisement.js"></script> <script type="text/javascript"> if (document.getElementById("tester") != undefined) { document.write(' '); } else { ga('send', 'event', 'Adblock Check', 'display', 'alert'); document.write('<div class="ipsMessage ipsMessage_error adblockDetectedMessage" style="margin-bottom: 0;"><a href="https://www.wikihow.com/Disable-AdBlock" target="_blank" id="helpTopicLink" class="ipsMessage_code ipsType_blendlinks ipsPos_right" title="How to disable adblock?" data-ipsTooltip><i class="fa fa-question"></i></a></div>'); } </script> Then I added this in styles.css to hide the checker part. #tester { display:none; } But no message is appearing anymore advertisement.js Link to comment
newbie LAC Posted October 7, 2020 Share Posted October 7, 2020 I have installed AdBlock and it does not block the script You should to change advertisement.js on the name which adblock blocks Link to comment
marklcfc Posted October 7, 2020 Author Share Posted October 7, 2020 (edited) 14 minutes ago, newbie LAC said: I have installed AdBlock and it does not block the script You should to change advertisement.js on the name which adblock blocks Did it not work? I couldn't understand if was saying it did or not. I've reinstalled it on my site, do you see the message @newbie LAC as I don't. https://www.foxestalk.co.uk/ Edited October 7, 2020 by marklcfc Link to comment
newbie LAC Posted October 7, 2020 Share Posted October 7, 2020 14 minutes ago, marklcfc said: do you see the message No 14 minutes ago, marklcfc said: You should to change advertisement.js on the name which adblock blocks change advertisement.js to advertisement.js?&ad_code= Link to comment
marklcfc Posted October 7, 2020 Author Share Posted October 7, 2020 (edited) 19 minutes ago, newbie LAC said: No change advertisement.js to advertisement.js?&ad_code= I changed that line in globaltemplate to <script type="text/javascript" src="/advertisement.js?&ad_code="></script> It's not showing, not sure if I was meant to put something else after = It shows occasionally when I hard refresh the page though Edited October 7, 2020 by marklcfc Link to comment
newbie LAC Posted October 7, 2020 Share Posted October 7, 2020 Uncaught ReferenceError: ga is not defined Comment the line ga('send', 'event', 'Adblock Check', 'display', 'alert'); marklcfc 1 Link to comment
marklcfc Posted October 7, 2020 Author Share Posted October 7, 2020 (edited) Thanks @newbie LAC that is working now 🙂 Edited October 7, 2020 by marklcfc Link to comment
Recommended Posts