Pa.js:1 Uncaught TypeError: r.split is not a function

Getting the following error in the console from the pirsch script, only on our homepage. https://www.walkhighlands.co.uk/

pa.js:1 Uncaught TypeError: r.split is not a function

it @ pa.js:1
Z @ pa.js:1
window.pirschInit @ pa.js:1

Any help appreciated.

Hi Paul,

Thank you for reporting :slight_smile:

That is because you have some links with a xlink:href attribute instead of a regular href. Here is an example:

Our script picks them up to check if they are file download links and if it needs to add an event to track them. It gets the file URL from the href attribute, which isn’t present in this case, resulting with the error you’re seeing.

We can fix this in a future update. You can also add the data-pirsch-ignore attribute to these specific links.

Thanks for the very fast response! I’ve removed the xlink:href and replaced with href as it appears to be deprecated (a long time ago!). However, still getting the error.

Hmm, odd. I can’t see any broken ahref attributes anymore, but there are other syntax errors in some of the links.

<a class="app-link top w-inline-block" href="app.php" ); background-size:75px'>
                                                      ^

<a class="app-link w-inline-block" href="/munros/" '>
                                                   ^

Maybe there are causing the error now? You can get a list by pasting the following code into your browser console and hitting enter:

document.getElementsByTagName("a")

Sorry - have removed those typos and think all a elements are valid, but still getting this error. It still seems to be recording though.

Hmm, there must be an error somewhere. Anyways, I’ll ensure that this won’t trigger an error in a future update :slight_smile: