Script error when using marketo "munchkin" api script

I want to introduce a Marketo visitor to my site. For this, I entered Marketo. I have a code and I pasted it on footer.php. But I get a script error on the console.

TypeError: a undefined

This is my code.

<script type="text/javascript"> document.write(unescape("%3Cscript src='" + document.location.protocol + "//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E")); </script> <script>Munchkin.init('My Id');</script> 

What is the problem?

+4
source share
1 answer

After debugging munchkin.js, I could understand that it is making a call to $ .browser, which is deprecated in jquery 1.9.

http://jquery.com/upgrade-guide/1.9/#jquery-browser-removed

To solve this problem, I used a jquery migrate script to include the $ .browser method. All I had to do was enable the script migration just below the jquery script tag

https://github.com/jquery/jquery-migrate/#readme

Hope this helps.

0
source

Source: https://habr.com/ru/post/1489441/


All Articles