• Resolved Generosus

    (@generosus)


    Good Day,

    Just noticed … your latest plugin update, V5.2.1, is causing a console error.

    The console error is: Uncaught SyntaxError: Unexpected token ‘,’

    Details: https://prnt.sc/o8g_BL4NpLyi

    The above occurs with your plugins, Analytify – Google Analytics Dashboard and Analytify Pro. When we deactivate either plugin, the console error disappears.

    Kindly review and provide a fix. It appears your revised or updated code has an extra comma in it.

    Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Generosus

    (@generosus)

    Disregard. It appears the issue was caused by Google Analytics’ code (fixed in the back end).

    Thread Starter Generosus

    (@generosus)

    Update:

    We found the culprit to this issue. The console error appears when we enable “Enable Google Optimze Async Hide” within Analytify’s Settings > Tracking > Google Optimizer.

    Details: https://prnt.sc/mvqbjUHcBIW6

    Is this the normal or expected behavior when Async Hide is enabled? Perhaps you can revisit your code to eliminate this finding.

    Thank you!

    Plugin Author Adnan

    (@hiddenpearls)

    @generosus

    This seems like something else, We tried to reproduce the bug with all the possible options but never appeared on our side. Can you help in debugging more?

    Thread Starter Generosus

    (@generosus)

    Hi Adnan,

    All we can say is that when we enable “Enable Google Optimize Async Hide” within Analytify’s Settings > Tracking > Google Optimizer (with no other data in the noted fields), we get the page Console Error: “Uncaught SyntaxError: Unexpected token ‘,’” on all of our website pages.

    No biggie, just thought I’d bring it up to your attention. If anything, it looks like your code may have a “comma” where it isn’t needed.

    Thank you.

    Plugin Support Emma

    (@emma24)

    Hi @generosus,

    We did the same and got no error in console. Also, we did thoroughly checked our code and found no such comma that would cause an issue.

    There might be an issue specifically with your environment. If you want us to investigate, please contact us on our support forum. Otherwise, I am marking this issue as resolved.

    Thank you for being a great user for Analytify! ??

    Thread Starter Generosus

    (@generosus)

    *** UPDATE ***

    Troubleshooting:

    (1) We disabled all of our plugins, except yours and still got the console error when we enabled “Enable Google Optimize Async Hide” within Analytify’s Settings > Tracking > Google Optimizer (with no other data in the noted fields).

    Details (Plugin Setting): https://prnt.sc/-jIyuMvW_LmW
    Details (Console Error): https://prnt.sc/d-wqL9feTJnY

    (2) When we entered a value in the “Google Optimize Async Hide Time” field (say, 200), the console error disappeared.

    Details (Plugin Setting): https://prnt.sc/C01EqeBPClzO
    Details (No Console Error): https://prnt.sc/5EbcXBbYdTWN

    Root Cause:

    A detailed inspection of the console error revealed that the code snippet associated with “Google Optimize Async Hide” depends on a “Hide Time” for it to work properly. The code snippet — developed by Google — is given below. Please notice the “Hide Time” of 200 we picked above. Without a selected hide time value, the code snippet transforms itself to “, ,” which is what caused the console error. In other words, Google Analytics always expects a value in this field.

    <style>.async-hide { opacity: 0 !important} </style>
    <script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
    h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
    (a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
    })(window,document.documentElement,'async-hide','dataLayer',200,
    {'':true});</script>

    Analysis and Solution:

    So, in short, the console error is expected if the fields provided in your “Google Optimizer Async Hide” module are not filled out properly.

    You should be able to replicate the above. Otherwise, you’re not following properly what we shared above.

    Case closed ??

    Plugin Support Emma

    (@emma24)

    Thank you, @generosus,

    We have successfully replicated the reported issue based on the detailed information provided. After identifying the root cause, we have already resolved the issue. The fix will be included in the upcoming update, which will be released soon.

    Once again, we appreciate your valuable contribution in identifying the issue!

    Plugin Support Emma

    (@emma24)

    Hi @generosus,

    I am pleased to inform that we have released Analytify Pro v5.2.1, that has this fix you highlighted: “Google Optimize settings error in Console log”.

    Thanks again!

    Thread Starter Generosus

    (@generosus)

    Hi there!

    Issue fixed. Thank you!

    Observation: When we activate your add-on, Google Optimize, PageSpeed Insights (PSI) detects an additional 40-50 kb of unused JS. Is this normal? If not, what do you recommend to fix this?

    Recommendations: https://prnt.sc/wKL2bloR9XQO

    Note: We temporarily changed the status of this topic to “Not Resolved” to give you a chance to review and reply to our Observation and Recommendations. We’ll change the status to “Resolved” once you reply.

    Until next time ??

    Plugin Support Emma

    (@emma24)

    Hi,

    Thanks for the recommendations! They are noted and forwarded to the dev team to work on it.

    About the observations, the dev team is already working on JS Optimization, which includes minifying JS and removing any unused JS.

    Your contributions are always appreciated and considered. Thanks again! ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Console Error Caused By Plugin | V5.2.1’ is closed to new replies.