Dynamically output JavaScript fails due to tags
-
First, thanks for the plugin! I’m using the latest version of the plugin, without any third party analytics plugins. I have add tracking code checked, display advertising unchecked, universal analytics checked, ecommerce tracking checked, and event tracking checked.
I was debugging ecommerce tracking, which hasn’t been working for me. When completing a transaction and arriving at the thank you page, where the ecommerce javascript is injected, I was receiving an error message in the Chrome Developer Tools, which is how I found out that the JavaScript output by the plugin’s ecommerce_tracking_code function was being filtered somewhere (with autop?) and had a bunch of
<p>
and</p>
tags in the middle of the script, causing it to fail.I tried for awhile to mess around with autop and shortcode_unautop in my functions.php, but couldn’t find a way to stop that script from being mangled. So as a temporary workaround, I removed the extra linebreaks in the ecommerce_tracking_code function (e.g. line 230) so that they wouldn’t be wrapped with
<p></p>
. Now it’s working for me.Could you see if you can duplicate this, and incorporate a fix in the next release? This might be what is causing ecommerce tracking to fail for other users.
https://www.ads-software.com/plugins/woocommerce-google-analytics-integration/
- The topic ‘Dynamically output JavaScript fails due to tags’ is closed to new replies.