doublesecretagency/craft-adwizard

Not registering clicks

Closed this issue · 5 comments

Hello everybody...
Im usign Blitz caching and because of that i had an issue with 'adWizard is not defined'

After exploring, i copied superagent and aw js in suitable folder location, now i dont have that problem, but when I click on ad, click is not registered, and this is the issue that ive got
image

P.S. Im using Sprig to inject ad

For everybody who have the same issue, this is my current solution

Its pretty much based on this comment https://github.com/doublesecretagency/craft-adwizard/issues/9#issuecomment-833375065

only difference is to change this
data[window.csrfTokenName] = result;

with
data['CRAFT_CSRF_TOKEN'] = result;

I have the same problem. can anyone help me?

Sprig Componente:

{# prettier-ignore-start #}
{% if sprig.isRequest %}
  {% set leaderboard = craft.adWizard.ads.group('leaderboard').orderBy('RAND()')|first %}
  
  {% if leaderboard %}
    <div class="p-3 bg-white">
      <div class="w-full max-w-[728px] mx-auto rounded-[4px] overflow-hidden">
        {{ leaderboard.displayAd({
            'attr': {
              'class': 'leaderboard',
            },
        }) }}
      </div>
    </div>
  {% endif %}
{% endif %}
{# prettier-ignore-start #}

Inject

{{ sprig('_sprig/headerAds', {}, { 's-trigger': 'load' }) }}

image

{# prettier-ignore-start #}

Looks like you're completely missing JS files from AdWizard

Looks like you're completely missing JS files from AdWizard

Yes, I was really forgetting. I managed to solve it based on this discussion.

#9 (comment)

Thanks.