• [deleted]

malago I can wait as in last few days I learnt the concept of WLCR

The more you wait and learn, the more you'll get relaxing

@malago you revived my hopes on ads again, am following your post, Great work! You say google adsense ads are not showing properly? You will make the work easy if you could share a google adsense ad code here so we all troubleshoot since some of us have the knowledge but dont have adsense accounts, dont you think so?

Lets have the extension installed and adsense code and other ad codes, to try we complete this in few days!

    Is there a way that I can adopt this to a specific site? Basically I have an image an an address that I want to point the user to when they click on it, I'll need to track how many view and click as well.

      [deleted] thank you this looks like a step in the right direction for me. I'm pretty new to web dev so can you please be a little more specific. Let's say for example I want to place an ads for "facebook.com" on my forum. I have a banner for the ads, and this api. How can I configure this extension to display a clickable ads that would direct the user to "facebook.com" and also track the number of click?

        • [deleted]

        huuduy216 It is very easy copy the same and paste where you want don't forget to change huuduy-ads-counting to something unique.

        <a onclick="userClickCount()" href="myMONEYlinkhaahha"><img src="https://discuss.flarum.org/assets/logo-9yg6hfqg.png"/></a>
        <script>
        function userClickCount() {
            var xhr = new XMLHttpRequest();
            xhr.open("GET", "https://api.countapi.xyz/hit/huuduy-ads-counting/fb-ad-img");
            xhr.responseType = "json";
            xhr.send();
        }
        </script>

        Now if you want to see visits as an admin go to this URL,
        https://api.countapi.xyz/info/huuduy-ads-counting/fb-ad-img

        Please generate new name for your domain or any name, You can also use this but maybe users here will click the links and test and it may result in wrong results

        To make a new one Change huuduy-ads-counting to something unique and don't tell anyone.

        Debaucus have you installed it yet? I had a different idea, if the html code can display in between the discussion, could we use a spoiler? e.g the flarum one by inserting [details title="Header Title"] ad message hidden text [/details] and maybe it can be simple. What do you think about that? Can this way work?

        a month later

        malago
        AdSense

        it is showing the ads for one time only when opening the homepage and when I open any discussion and comes back to the homepage it doesn't show any ad anywhere.

          xasharma I know, it does not work well with Adsense, it's on the list if issues... And I couldn't figure out how to fix it.

          This has been this way ok the original extension. If someone has any idea how to make it work, let me know!

            malago I haven't followed the discussion, but take a look at what I did here. You can execute the JavaScript code in the injected HTML and do that only once. (It only works for ads between posts for now, I'm not using sidebar ads so I didn't implement it.)

              matteocontrini This is excellent, thanks for sharing!

              I made it work on my local installation but for some reason it is not loading the Google .js on my browser on the online version... I need one or two volunteers to try the dev version online!

              Justoverclock xasharma

              composer require malago/flarum-ads:dev-main

              Thanks 😄

              Actually I have no connection 😓waiting a fix from my provider but sure when I’m back I will try 🙂

              I have tried each types of ads ... but i feel that Display ads are working better.

              Good jobs @malago
              I test in some weeks when my small community go live.

              For future updates maybe a good idea some steps:

              • Working with roles to avoid the Ads for some users groups. Example: Premium members.
              • Some more places to add advertisements

              Suggestion:

              Ability to add Auto-Ad code the the Header for Google Adsense.