Debugger not in view on site

Hi,

I have placed MTM in debugger mode but when I go to load my page with the prefix suffix the debugger view doesn’t show.

Could we take this conversation offline and I can share the preview link with you?

Are there any extensions that you know of that might be interrupting Matomo?

BR
Adam

Hi,

If you want to, you can send me a direct message with the URL.

I can’t promise to find the solution though.

Hi Lukas,

Thanks for getting in touch.

The debugger should be working on the following:

We really need a solution, otherwise I’m concerned that MTM is pretty useless if we can’t test to see how tags are firing/variables are showing etc.

BR

Adam

Hi,

Well, I can at least get you a little bit farther:
The JavaScript file generated by Tag Manager is invalid:
container_T1zrjXa0_preview.js

Templates['CustomJsFunctionVariableda25e980'] = (function () { return function (parameters, TagManager) { this.get = function() {
  var el = {{Find closest}}({{Click Element}}, 'div[data-target^="#modal"]');
  return typeof el !== 'undefined' ? {{Click Text}} : undefined;
}; } })(); 

These {{Click Element}} and {{Find closest}} should not show up in the code.
I don’t know if this is a bug in MTM or a typo in your Custom Variable, but it would help if you could post this custom variable here.

Thanks

Hi Lukas,

Great, thanks for pointing this out. The custom variable was for created to try and extract some info based on a click element. This is the custom variable, it’s something that we have previously used in GTM, so hoped it would be transferrable:

function() {
  return function(target, selector) {
    while (!target.matches(selector) && !target.matches('body')) {
      target = target.parentElement;
    }
    return target.matches(selector) ? target : undefined;
  }
}

Would you recommend that I pause this tag for the time being? Or should I just remove those variables and test the preview again?

Also could I ask that you remove the link to the preview from your previous message as I wasn’t aware that these messages were on the public forum when I replied earlier.

BR
Adam

Hi,

No problem, I have hidden the URL in all posts.

The custom variable you are posting isn’t the one I mean (and that is broken). Yours is showing up fine in the compiled JavaScript file:

Templates['CustomJsFunctionVariablefa6d2f08'] = (function () { return function (parameters, TagManager) { this.get = function() {
  return function(target, selector) {
    while (!target.matches(selector) && !target.matches('body')) {
      target = target.parentElement;
    }
    return target.matches(selector) ? target : undefined;
  }
}; } })(); 

I don’t know the URL so only guessing… are the variables “Find closest”, “click element”, and “click text” created?

It appears to me that eg the variable “Click text” does not exist? Can you confirm @Adam1234 ?

Hi both,

@thomas_matomo - thanks for spotting that, I guess I had the previous GTM naming still for those variables. These are now corrected so hopefully all the variables are correct in this particular custom js now. {{Find closest}} is created and the code is the previous code that I’d sent to Lukas on this thread.

@Lukas - in which case I think the below is the code (now updated as above):

function() {
var el = {{Find closest}}({{ClickElement}}, ‘div[data-target^="#modal"]’);
return typeof el !== ‘undefined’ ? {{ClickText}} : undefined;
}

Let me know if you think there is anything else that might be causing a fault here.

BR
Adam

I both, just to let you know that I have removed the variable and corresponding tag and this has fixed the error.

Thanks for your help in locating the issue.

BR
Adam