Live chat is not working on AMP-first Wordpress blog

Highlighted
New Contributor

Hi,

 

Live chat is not working on our Wordpress blog https://globemoving.net/blog/.

 

We are using AMP plugin. So it is AMP-first.  If I disable the plugin, the chat is showing.

 

I tried with/without Hubspot plugin installed. You can check the code in the front-end and in the back-end.

 

footer.pngfront-endsource.pngback-end

amp-dis.pngand when AMP disabled

I think AMP is blocking the code. Do you have a solution for this?

 

Thanks

Reply
0 Upvotes
5 Replies 5
Top Advisor | Gold Partner

@someshwar  - First, I would ensure that you can actually put script tags and javascript code in the place where you are putting that HS embed code. I'm not exactly sure from the screenshot, which file you have your embed code in, or if it's a plugin like "Simple Custom CSS / JS" that let's you inject code. 

 

So, first step to debug is to replace your HS code with this code - 

<script>alert();</script>

If you see a popup appear on the page, then you know the problem is most likely the script source. 

 

If the alert() happens, next I would try injecting the HS code dynamically with this code:

<script>
var script = document.createElement('script');
script.src='https://js.hs-scripts.com/6244164.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
</script>

If the alert() didn't happen, I would try using a plugin like the one I mention above. 

https://wordpress.org/plugins/custom-css-js/

New Contributor

Hey @tjoyce,

 

thanks for the response. I replaced the HS script with <script>alert();</script> popup is not appearing.

 

I tried with "Simple Custom CSS / JS" plugin too. Not working.

 

 

Reply
0 Upvotes
Top Advisor | Gold Partner

I notice you have a cache plugin. Did you make sure when you used the custom CSS plugin that the cached version wasn't being delivered? Can you disable the cache while you're in development?

 

cache.png

Reply
0 Upvotes
New Contributor

@tjoyce,

 

I disabled the cache plugin and check. Still the same. Not showing.

Reply
0 Upvotes
New Member

Hey.

 

This is Arturs from Magebit. We have an AMP website ourselves and stumbled upon this issue also.

 

AMP doesn't really allow custom javascript code. Therefore, live chats on AMP are tricky. It is possible to apply for developer mode where you are able to write limited javascript on your site but I think it will still not be enough to use HubSpot's live chat module properly.

 

Unless HubSpot releases an AMP version of the live chat, I don't see a way to get AMP and their live chat to working together.

 

I've seen AMP + live chats (i.e. facebook live chat on AMP sites) so it is possible. Just not with HubSpot for now. Hopefully, they will come up with an AMP live chat soon Smiley Happy

 

Cheers

Reply
0 Upvotes