• Help Desk reporting gives you real-time visibility into your support operation without the manual work. Ask our experts about which metrics matter most! AMA Dec 8-12.

    Ask us anything

launching chat from a link

zogics
Participant

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?

3 Accepted solutions
MFrankJohnson
Solution
Thought Leader

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: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com

View solution in original post

Solution
Anonymous
Not applicable

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

 

🙂 

View solution in original post

cquesadad
Solution
Participant

Perfect! I understod: here the complete solution that wordked for me:

 

<a id="click-to-chat__cta--text" class="cta cta--blue" style="margin-top: 20px;" onclick="window.HubSpotConversations.widget.open()" href="#hs-chat-open">Chat with Sales</a>

View solution in original post

34 Replies 34
MatthewShepherd
Key Advisor

For anyone looking to not load their chat widget at all until a button is clicked (rather than popping open a chat widget that has already loaded as discussed above), take a look at this post: https://community.hubspot.com/t5/Tips-Tricks-Best-Practices/onclick-action-doesn-t-work/m-p/457288#M...

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.
pixii
Participant

@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.

mediPr
Participant

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

sharonlicari
HubSpot Alumni
HubSpot Alumni

Thank you for sharing @pixii 


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

mediPr
Participant

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

0 Upvotes
PamCotton
HubSpot Alumni
HubSpot Alumni

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

0 Upvotes
MFrankJohnson
Solution
Thought Leader

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: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
WareWorks
Member

Hi Frank

 

This is not working for me and generating a client side error, Any idea about this?

 

Uncaught TypeError: Cannot read property 'messages' of undefined
at HTMLAnchorElement.onclick ((index):503)

 

0 Upvotes
Anonymous
Not applicable

is it still be availlable to consider it valid for the time being today dgme

0 Upvotes
MiaSrebrnjak
Community Manager
Community Manager

HI @WareWorks,

 

Welcome to the Community! It would be great if you can share which troubleshooting steps you have taken so far and include a screenshot of the error so the Community has more information to work with. 

 

Thanks

Mia 


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

WareWorks
Member

Hi Mia

 

I have resolved this issue. Thank you for your help. 

 

WW

MiaSrebrnjak
Community Manager
Community Manager

Thank you @WareWorks, I'm glad you were able to find a solution!

 

Have a great rest of your day

Mia 


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

RZhang
Member

Hi  i have tried it, but i dont work.
is there anything wrong??

https://campaign.innovatingautomation.asia/test 

 

0 Upvotes
PamCotton
HubSpot Alumni
HubSpot Alumni

Hello @RZhang could you please provide us more details in what was changed on your end? 

 

Thank you,

Pam

RZhang
Member

Hi Pam,

I want to realize the effect like that:

When I click a button, the chat box come out in a new tab. Please check the attachment.

https://community.hubspot.com/t5/Tickets-Conversations/launching-chat-from-a-link/td-p/252778


Best Regards

0 Upvotes
soumlabs
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?

0 Upvotes
Solution
Anonymous
Not applicable

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

 

🙂 

CAmmann
Participant

That works, however, with the delay set. Does anyone know how the chat window will open immediately?

0 Upvotes
kvlschaefer
Community Manager
Community Manager

Hi @CAmmann,

 

Thanks for reaching out! 

 

This thread is 4 years old and may not have full visibility among our Community Members.

 

To ensure that your question is seen by our community members, I would encourage you to create a new post on the Community.

 

Please make sure to include a full description of the issue you are running into or your goal and any pertinent screenshots in the new post for the Community to better assist with the next steps. Thank you! 

 

Best,

Kristen


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

0 Upvotes
cquesadad
Solution
Participant

Perfect! I understod: here the complete solution that wordked for me:

 

<a id="click-to-chat__cta--text" class="cta cta--blue" style="margin-top: 20px;" onclick="window.HubSpotConversations.widget.open()" href="#hs-chat-open">Chat with Sales</a>