launching chat from a link

SOLVE
Occasional Contributor

We would like to be able to launch the chat conversation from the click of a link. We have a couple of uses cases on our e-commerce site:

 

1) is the "Talk to an Expert" link on our product description pages like here:

https://zogics.com/gym-wipes/antibacterial-gym-wipes-z800-4-rolls-case

(located under quantity option and above add to cart button)

2) the "click here" text link after "Chat:"

3) In our footer - the live chat option 

 

We migrated our chat service from SnapEngage - and we used to use JavaScript to make this happen.

 

<a onclick="return SnapEngage.startLink();" href="javascript&colon;void(0);" title="Talk to an Expert">Talk To An Expert</a>

 

Does anyone know the equivalent on click link for the HubSpot chat? Or an alternative solution?

1 Accepted solution

Accepted Solutions
Solution
Community Superstar

Try this ...

<a id="click-to-chat__cta--text" class="cta cta--blue" style="margin-top: 20px;" onclick="window.hubspot.messages.EXPERIMENTAL_API.requestWidgetOpen();">Chat with Sales</a>

 

Note: HubSpot is a constantly evolving platform. Please check the date of each post and view all solutions in that context.

-- Visit

 

Hope that helps.

 

Be well,
Frank


Support • Web • Apps • Training

HubSpot's Hiring World-Wide!

View solution in original post

21 Replies 21
Solution
Community Superstar

Try this ...

<a id="click-to-chat__cta--text" class="cta cta--blue" style="margin-top: 20px;" onclick="window.hubspot.messages.EXPERIMENTAL_API.requestWidgetOpen();">Chat with Sales</a>

 

Note: HubSpot is a constantly evolving platform. Please check the date of each post and view all solutions in that context.

-- Visit

 

Hope that helps.

 

Be well,
Frank


Support • Web • Apps • Training

HubSpot's Hiring World-Wide!

View solution in original post

Occasional Contributor

You are a "super-genius" - yes it works. Thank you thank yoy!

Reply
0 Upvotes
Community Superstar

No genious. Just resourceful HubSpot researcher.

Please mark as solved. Thanks

 

Note: HubSpot is a constantly evolving platform. Please check the date of each post and view all solutions in that context.

-- Visit

 

Hope that helps.

 

Be well,
Frank


Support • Web • Apps • Training

HubSpot's Hiring World-Wide!

Reply
0 Upvotes
Regular Contributor

Hey but where do i put this piece of code? I'm no programmer. Also, i see their website they have moved the chat widget to middle of the pages. How to do it?

Reply
0 Upvotes
Regular Contributor

No code required, just "Append #hs-chat-open to the end of your URL to trigger the chat widget launch."

 

Reference: https://knowledge.hubspot.com/articles/kcs_article/conversations/chat-with-your-website-visitors

 

🙂 

Regular Contributor

That is not the solution. It will refresh the page upon clicking the hyper link. I don't want the page to refresh.

Reply
0 Upvotes
Regular Contributor

Then it would help to specify your requirments in more detail 

Reply
0 Upvotes
Regular Contributor

I just want it to work like it is working in the website of the originial poster of this thread. Click the hyperlink and the chat opens up without refreshing the page.

 

Go to the footer of this website and click the live chat hyperlink text

 

https://zogics.com/gym-wipes/antibacterial-gym-wipes-z800-4-rolls-case

Reply
0 Upvotes
Regular Contributor

@soumlabs  If you want the button/link to open the chat bubble without a page refresh/reload, then don't use the full page link, and just link to the anchor instead.

 

here you go:

 

<a href="#hs-chat-open">Open chat</a>

 

Did my post help your query? Help the community by Marking it as a solution if it solved your query. In addition, Upvotes are welcome too.

Reply
0 Upvotes
Regular Contributor

It was worse than refreshing page. When I clicked the hyperlink, it took my off to a different 404 not found page and then it opened the chat window.

@marclosper 

Reply
0 Upvotes
Community Superstar

- see Chat with your website visitors regarding use of #hs-chat-open

- see original solution above (also, image below)

 

hubspot-chat-code-onclick-click-to-open.png

 

 

Note: HubSpot is a constantly evolving platform. Please check the date of each post and view all solutions in that context.

-- Visit

 

Hope that helps.

 

Be well,
Frank


Support • Web • Apps • Training

HubSpot's Hiring World-Wide!

Reply
0 Upvotes
Regular Contributor

@MFrankJohnson  Please stick to DRY principles. Not sure why you'd want to add JS when a simple anchor link works and is the suggested solution as per the Hubspot documentation - link above

Reply
0 Upvotes
Community Superstar

>>"MFrankJohnson Please stick to DRY principles. Not sure why you'd want to add JS when a simple anchor link works and is the suggested solution as per the Hubspot documentation..."

 

WOW, Lopser. Appreciate the flogging.


However, one of the reasons the HubSpot Community exists is because HubSpot documented/suggested solutions don't always solve for all use cases.


-ps
The HubSpot Community is a place where EVERYONE is welcome to post their solutions without being patronized or condescended to. BTW - DRY development speaks to reduction in reduncancy and code repetition specifically -- not the use of alternative solutions or .js.

#nlmtu

 

Note: HubSpot is a constantly evolving platform. Please check the date of each post and view all solutions in that context.

-- Visit

 

Hope that helps.

 

Be well,
Frank


Support • Web • Apps • Training

HubSpot's Hiring World-Wide!

Regular Contributor

@MFrankJohnson I'm not saying your solution isn't correct, I'm saying that you are recreating the wheel when it's not neccessary - there's a simpler way to implement.

 

A couple of extra characters or requests here and some more there all adds up and will impact your website performance.

 

Re: my previous reply, you are right, everyone is welcome to post. I apologise, sometimes my OCD gets the better of me.

 

Best of luck

Regular Contributor

The anchor redirected the page to a 404 and then it opened the chat. 

Reply
0 Upvotes
Regular Contributor

@MFrankJohnson I couldn't try your method as I don't know where to put code. Explain?

Reply
0 Upvotes
New Contributor

I implemented this on my websites and it was working, but a recent update seems to have broken it on two independent website. Anyone experiencing the same? Any solutions? Thanks

Reply
0 Upvotes
Community Manager

Hello @mediPr 

 

Would you be able to provide us more information about what is happening in your end?  The more information, screenshots, and details you can provide, the better I can advise on the next steps.

 

Thank you,

Pam

Você sabia que a Comunidade está disponível em outros idiomas?
Participe de conversas regionais, alterando suas configurações de idioma !


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


Reply
0 Upvotes
New Contributor

@mediPr I had the same thing happen to buttons across my entire site, sometime in the last few weeks.

 

I found something that works.

 

Solution:

 

Where your code had:

onclick="window.hubspot.messages.EXPERIMENTAL_API.requestWidgetOpen();"

 

Replace with:

onclick="window.HubSpotConversations.widget.open();"

 

This should fix it.

Community Manager

Thank you for sharing @pixii 


¿Sabías que la Comunidad está disponible en Español?
¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuraciones!

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


New Contributor

Hi, thanks so much. Excellent. This solved my issue!