CMS Development

JonnyZOO
Contributor

Javascript counter stopped working

SOLVE

Hi there

 

I've noticed that the Javascript counter we use on the below URL has stopped working:
https://www.zoodigital.com/services/localize/subtitling

 

In the 'Built for volume!' section, the counter should pull through a number from 'https://ticker.zoodigital.com/zoosubs_stats.jsonp', however the backup 'Working...' text is displaying instead.

 

Here's the code snippet:

{{ require_js(get_public_template_url("Custom/page/ZOO_Digital_Jan_2017-theme/ZOOsubs_ticker.js")) }} {{ require_js("https://ticker.zoodigital.com/zoosubs_stats.jsonp", "footer") }}
<h2>Built for volume!</h2>
<p>Look how many subtitles and captions we've created and stored securely so far using ZOOsubs.</p>
<h3 id="ZOOsubsTicker">Working...</h3>

 

We've not changed anything on the page so can't understand why it's behaving differently in the last week or so.

 

 

Any ideas what could've caused the error? And how it can be fixed?

0 Upvotes
1 Accepted solution
Jsum
Solution
Key Advisor

Javascript counter stopped working

SOLVE

@JonnyZOO,

 

first, I wouldn't recommend loading your scripts in the middle of the page. It would be better to use the head of the document, or better yet the footer if possible. 

 

that being said, you have an error in your console that I am sure is related: 

Uncaught ReferenceError: ZOOsubs_ticker is not defined

If 'Zoosubs_ticker' was defined and the timer was working, and now it isn't working, something has to have changed. Maybe it wasn't to the page directly. Does your site have a central javascript file? Is it possible someone moved some files around? did you recently upgrade the module containing the code (provided it is in a custom module)? 

 

I get the 'x is not defined' on inline onclick events when I have my function in the javascript section of the custom module interface. I have to place the javascript in my html with <script> tags. 

 

I would suggest trying to revert back to a previous version of the template, not to far  back but at least to when you were sure it was working. If it still isn't working then the issue is coming from outside the template from one of the assets attached to the template.

 

Need help? Hire Us Here

View solution in original post

6 Replies 6
Jsum
Solution
Key Advisor

Javascript counter stopped working

SOLVE

@JonnyZOO,

 

first, I wouldn't recommend loading your scripts in the middle of the page. It would be better to use the head of the document, or better yet the footer if possible. 

 

that being said, you have an error in your console that I am sure is related: 

Uncaught ReferenceError: ZOOsubs_ticker is not defined

If 'Zoosubs_ticker' was defined and the timer was working, and now it isn't working, something has to have changed. Maybe it wasn't to the page directly. Does your site have a central javascript file? Is it possible someone moved some files around? did you recently upgrade the module containing the code (provided it is in a custom module)? 

 

I get the 'x is not defined' on inline onclick events when I have my function in the javascript section of the custom module interface. I have to place the javascript in my html with <script> tags. 

 

I would suggest trying to revert back to a previous version of the template, not to far  back but at least to when you were sure it was working. If it still isn't working then the issue is coming from outside the template from one of the assets attached to the template.

 

Need help? Hire Us Here

JonnyZOO
Contributor

Javascript counter stopped working

SOLVE

Hi @Jsum

 

Thanks for the reply. I'll pass your response over to our dev team to see if they can shed any light.

 

In terms of reverting back to previous versions, the last revision of the template itself was some time last year. While the associated stylesheet was last edited on the 14/08/18 and the problem only started occuring around 12/09/18.

0 Upvotes
Jsum
Key Advisor

Javascript counter stopped working

SOLVE

@JonnyZOO, hmm... it wouldn't be the css in most cases, but the template would have been a likely suspect. What about the javascript files associated with the counter?

 

Need help? Hire Us Here

JonnyZOO
Contributor

Javascript counter stopped working

SOLVE

Hey @Jsum

 

Just an update on this, the JavaScript needed linking to the template. I'm guessing this is due to an update in HubSpot's design manager, as I can't remember seeing this option a few weeks back.

 

Screen Shot 2018-09-26 at 12.45.00.png

Thanks anyway for your help.

0 Upvotes
Jsum
Key Advisor

Javascript counter stopped working

SOLVE

That has always been there but I'm glad you found it. I thought it might be. If yours or any of these answers helped please mark them as the solution for others.

 

Need help? Hire Us Here

0 Upvotes
JonnyZOO
Contributor

Javascript counter stopped working

SOLVE

Strange, as we hadn't changed the template at all before the counter stopped working, yet this was the only step that fixed the issue.

0 Upvotes