It should not come as a big surprise to people reading this that this error is almost always due to a formatting problem. The part that trips people up is that this often occurs in Google Tag Manager when someone is copy/pasting code from one system to the next, so nothing is being edited and people wonder how the formatting could possibly be wrong. First, let’s make sure this is the right thread for you, then we’ll get the solution and root cause so you can:
- Fix your current problem
- Know when it will occur in the future so you can avoid it
This is the error we’re specifically focusing on:
You can easily fix this by deleting the extra quotations so it matches the original code. Once you do, hit save, then publish, and voila! Your work here is done.
If you’re looking at your code and you can’t see the difference, there’s a really clever little tool that will make your life so much easier called DiffChecker. It’s 100% free. Just copy/paste your original code from excel into one side of diffchecker, then copy/paste your code that you just copied into Google Tag Manager and hit “Find Difference”. Even if your formatting error was not caused by an excel copy/paste this tool will still help you find any errors, so you can narrow down the root cause.