Using Geotargetly with Discourse

AI-generated summary

lonelycaptain is struggling to integrate Geotargetly with their Discourse forum for displaying personalized in-house ads. They have successfully used Geotargetly on their main site to display country-specific content, but the same approach does not work on their forum. They added the required geocontent code in the theme customization and modified their in-house ad with Geotargetly smart tags, but the ad does not display when wrapped inside the geo smart tags.

Hi everyone, it’s my first post here but I’ve been using Discourse for my community for one year now.

I have a question regarding an integration I’m struggling with. I’m using Geotargetly on my main site to display personalised content as I have readers from different French-speaking countries. It’s been working great so I thought about using it on my forum for in-house ads. So basically what I did is add the required geocontent code in the body section of the theme customization:

<script>
(function(g,e,o,t,a,r,ge,tl,y){
s=function(){var def='geotargetlygeocontent1587255810065_default',len=g.getElementsByClassName(def).length;
if(len>0){for(i=0;i<len;i++){g.getElementsByClassName(def)[i].style.display='inline';}}};
t=g.getElementsByTagName(e)[0];y=g.createElement(e);
y.async=true;y.src='https://g1584674684.co/gc?winurl='+encodeURIComponent(window.location)+'&refurl='+g.referrer+'&id=-M5EoOQ0UCkoiZcIwAK7';
t.parentNode.insertBefore(y,t);y.onerror=function(){s()};
})(document,'script');
</script>
<noscript><style>.geotargetlygeocontent1587255810065_default{display:inline !important}</style></noscript>

Then I modified my in-house ad by adding the Geotargetly smart tags as follows:

<span class='geotargetlygeocontent1587255810065_default' style='display:none;'>
-- My ad content here --
</span>

On my main site I would just add for example three different smart tags for three different countries and it would display the correct content depending on the country.

Unfortunately it doesn’t work at all with my Discourse forum. The in-house won’t display at all when I wrap it inside the geo smart tags. Is there anything I’m doing wrong, or are there limitations with in-house ads I’m not aware of?