One goal is not taken in account others are OK. Code is the same

Hello,

  • I have several goals and it works fine for all my sites.
  • I added a new goal, and this goal is managed with the same hugo code than others
    • In this case it is a click on a menu item
    • Goal name : “Shop”.
  • I can see the page being hit in real time. But no trace for this goal. Others goals/click react as expected.
  • I do not have errors on inspector.

You can see it in action

I’m stuck trying to debug this strange thing on Chrome/Brave/Safari [EDIT : seems only on Safari, finally]

Any light ?

My generated HTML code

<script async defer data-domain="camping-arolla.com" src="https://stats.camping-arolla.com/js/index.js"></script>
 <script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>

...

<script>
function WebCocoon() {
    plausible('WebCocoon');
}
function Shop() {
    plausible('Shop');
}
</script>

And the menu for those 2 items is :

<li class="nav-item">
   <a class="nav-link"
         onclick="Shop()"
         href="/shop/">Shop</a>   
</li>

<li class="nav-item">
   <a class="nav-link"
       href="https://www.cocoon-arolla.com?ref=camping-arrola-link"
       onclick="WebCocoon()"
      target="_blank" rel="noreferrer">Cocoon</a>
</li>

Mmmmmm … It seems that it only occurs on Safari, but I see nothing blocked on safari.

OK. Didn’t found the cause for the script being buggy with my safari version.

Anyway I changed my logic to put the custom goal when loading the page and not clicking the menu.

Benefit ?

  • It works better with my multi language site (1 goal for all languages instead of 1 page for each language)
  • I updated my plausible-hugo module with more functionality ! ha ha ha