<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Hubspot Livechat on Google Tag Manager in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/317007#M30348</link>
    <description>&lt;P&gt;Thanks so much for sharing,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/118326"&gt;@stuartbrameld&lt;/a&gt;! I was&amp;nbsp;just about to take a look at your question from Monday.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since authoring &lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/316983#M30344" target="_self"&gt;my original solution&lt;/A&gt;, I've found that it only fires if it loads after&amp;nbsp;&lt;CODE&gt;window.HubSpotConversations&lt;/CODE&gt;. This tends to be unpredictable so the if/else statement with&amp;nbsp;&lt;CODE&gt;window.hsConversationsOnReady&lt;/CODE&gt; is often a more reliable option. (This is also outlined in the API's &lt;A href="https://developers.hubspot.com/docs/methods/conversations_api/hubspot-conversations-javascript-api" target="_self"&gt;documentation&lt;/A&gt;.)&lt;/P&gt;</description>
    <pubDate>Wed, 05 Feb 2020 17:37:44 GMT</pubDate>
    <dc:creator>IsaacTakushi</dc:creator>
    <dc:date>2020-02-05T17:37:44Z</dc:date>
    <item>
      <title>Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/240936#M19832</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have been trying to track Hubspot Livechat on Google Tag Manager (GTM). More specifically people who are coming from Google Ads then click the Livechat.&lt;/P&gt;
&lt;P&gt;Is there any way to do that? I asked Hubspot Support, but apparently there is no way to do that from Hubspot.&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 05:50:41 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/240936#M19832</guid>
      <dc:creator>yudhi_hamzah</dc:creator>
      <dc:date>2018-09-11T05:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/240937#M19833</link>
      <description>&lt;P&gt;Hi &lt;A class="mention" href="https://community.hubspot.com/u/yudhi.hamzah"&gt;@yudhi.hamzah&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;While it's not possible to track clicks to open the live chat widget in HubSpot, there &lt;EM&gt;may&lt;/EM&gt; be a way in Google Tag Manager.&lt;/P&gt;
&lt;P&gt;Most of the live chat modal is loaded through an iframe, so its elements can't be tracked through GTM. The iframe exists within a &lt;CODE&gt;div&lt;/CODE&gt; with the id &lt;CODE&gt;hubspot-messages-iframe-container&lt;/CODE&gt;, however, so you &lt;EM&gt;may&lt;/EM&gt; be able to create a click trigger with that id. See below.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;DIV class="lightbox-wrapper"&gt;&lt;A class="lightbox" href="https://community.hubspot.com/legacyfs/online/uploads/default/original/2X/6/631ee9e90884fb1bc165be44818d0e1f9ecd31e4.jpeg" data-download-href="/legacyfs/online/uploads/default/631ee9e90884fb1bc165be44818d0e1f9ecd31e4" title="Click ID Trigger.jpg"&gt;&lt;IMG src="https://community.hubspot.com/legacyfs/online/uploads/default/optimized/2X/6/631ee9e90884fb1bc165be44818d0e1f9ecd31e4_1_690x247.jpeg" alt="Click%20ID%20Trigger" width="690" height="247" /&gt;&lt;DIV class="meta"&gt;
&lt;SPAN class="filename"&gt;Click ID Trigger.jpg&lt;/SPAN&gt;&lt;SPAN class="informations"&gt;1041x374 32.5 KB&lt;/SPAN&gt;&lt;SPAN class="expand"&gt;&lt;/SPAN&gt;
&lt;/DIV&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 21:08:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/240937#M19833</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2018-09-19T21:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/240938#M19834</link>
      <description>&lt;P&gt;Hi &lt;A class="mention" href="https://community.hubspot.com/u/isaac_takushi"&gt;@Isaac_Takushi&lt;/A&gt; it still don't work. There is "hubspot-messages-iframe-container" ID in my HTML but somehow the trigger is not fired.&lt;/P&gt;
&lt;P&gt;I think the click is happening in the iframe. That is why I can't recognize the action (click).&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 02:21:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/240938#M19834</guid>
      <dc:creator>yudhi_hamzah</dc:creator>
      <dc:date>2018-09-25T02:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/240939#M19835</link>
      <description>&lt;P&gt;Thanks for the update, &lt;A class="mention" href="https://community.hubspot.com/u/yudhi.hamzah"&gt;@yudhi.hamzah&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;In that case, I don't know of a way to track clicks which open the live chat widget. &lt;CODE&gt;hubspot-messages-iframe-container&lt;/CODE&gt; is one of the few &lt;CODE&gt;div&lt;/CODE&gt; elements outside the &lt;CODE&gt;iframe&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;I certainly see value in tracking custom interactions with the live chat tool, however. I recommend upvoting and commenting on &lt;A href="https://community.hubspot.com/t5/HubSpot-Ideas/Possibility-to-open-the-chat-window-by-using-custom-button-js/idi-p/175889"&gt;this HubSpot Community Idea&lt;/A&gt; and any other topics which match your use case to help them become realities.&lt;/P&gt;
&lt;P&gt;This information is sent directly to our Product team and helps prioritize feature requests that have the greatest impact on our customers. I’ve already upvoted the idea and will also do my part and pass your feedback along through internal channels.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 12:51:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/240939#M19835</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2018-09-25T12:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/292891#M27310</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/665"&gt;@IsaacTakushi&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to know if there are updates on a way to track the chat with Google Tag Manager. Unfortunately, the only solution indicated does not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Pier&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 10:35:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/292891#M27310</guid>
      <dc:creator>Pier</dc:creator>
      <dc:date>2019-09-24T10:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/293219#M27362</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/106028"&gt;@Pier&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since this discussion was last active, we released a &lt;A href="https://developers.hubspot.com/docs/methods/conversations_api/hubspot-conversations-javascript-api" target="_self"&gt;Conversations Live Chat Widget API&lt;/A&gt;. The features include &lt;A href="https://developers.hubspot.com/docs/methods/conversations_api/widget_events" target="_self"&gt;these widget events&lt;/A&gt;, which you could use to trigger a Google Tag Manager event.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, the following script would listen for the start of a chat and trigger a GTM event named &lt;CODE&gt;hs_chat_started&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;window.HubSpotConversations.on('conversationStarted', payload =&amp;gt; {
  dataLayer.push({'event': 'hs_chat_started'});
});&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 15:54:36 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/293219#M27362</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2019-09-25T15:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/293346#M27408</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/665"&gt;@IsaacTakushi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much. I will try to track chat conversation.Unfortunately I'm not super competent with Google Tag Manager for custom tracking, a step by step guide would have been helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try until I can! Fingers crossed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 07:30:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/293346#M27408</guid>
      <dc:creator>Pier</dc:creator>
      <dc:date>2019-09-26T07:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/293376#M27415</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/106028"&gt;@Pier&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Happy I could be of assistance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are many step-by-step tutorials on tracking in Google Tag Manager available. Here are two I found:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://medium.com/analytics-for-humans/how-to-track-events-on-your-website-with-google-tag-manager-c9c4a510c77c" target="_self"&gt;How to track events on your website with Google Tag Manager&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://www.optimizesmart.com/event-tracking-in-google-tag-manager-v2-complete-guide/" target="_self"&gt;Guide to Event Tracking via google Tag Manager&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 26 Sep 2019 11:53:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/293376#M27415</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2019-09-26T11:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/306947#M29103</link>
      <description>&lt;P&gt;hi there &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/665"&gt;@IsaacTakushi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for sharign this, it is super helpful -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying the script you are mentiongin above into GTM but I get this error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;---&lt;BR /&gt;Error at line 2, character 55: This language feature is only supported for ECMASCRIPT6 mode or better: arrow function.&lt;/P&gt;&lt;P&gt;---&lt;BR /&gt;The script I use is this one:&lt;BR /&gt;&amp;nbsp;&lt;A href="https://monosnap.com/file/EguNehjH7qJUIFnuIhDNW4zAgc5g1H" target="_blank"&gt;https://monosnap.com/file/EguNehjH7qJUIFnuIhDNW4zAgc5g1H&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also the trigger I am using is this one:&amp;nbsp;&lt;BR /&gt;&lt;A href="https://monosnap.com/file/7wfoWz9nfatuUOS35vmPzPQM4sLHsv" target="_blank"&gt;https://monosnap.com/file/7wfoWz9nfatuUOS35vmPzPQM4sLHsv&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;If I chanege a little&amp;nbsp; bit the script:&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;window.HubSpotConversations.on('conversationStarted', function (payload) {&lt;BR /&gt;dataLayer.push({'event': 'hs_chat_started'});&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the trigger fires, I can see this on previewing the tag:&lt;BR /&gt;&lt;A href="https://monosnap.com/file/yIJYzWzAikVHLGXmzT3EHTjxF9CaQW" target="_blank"&gt;https://monosnap.com/file/yIJYzWzAikVHLGXmzT3EHTjxF9CaQW&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in hubspot the event is not increasing:&lt;BR /&gt;&lt;A href="https://monosnap.com/file/rc4CT5DcHwRPrPVDA3SGTznoVFsnzY" target="_blank"&gt;https://monosnap.com/file/rc4CT5DcHwRPrPVDA3SGTznoVFsnzY&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thansk a ton&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 11:04:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/306947#M29103</guid>
      <dc:creator>RiccardoPisani</dc:creator>
      <dc:date>2019-12-11T11:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/307270#M29141</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/10257"&gt;@RiccardoPisani&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for sharing your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you are expecting your code to trigger a &lt;A href="https://knowledge.hubspot.com/events/create-custom-events" target="_self"&gt;custom HubSpot event&lt;/A&gt; named &lt;CODE&gt;hs_chat_started&lt;/CODE&gt;. Is that correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, the following JavaScript will not do that:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;script&amp;gt;
window.HubSpotConversations.on('conversationStarted', function (payload) {
dataLayer.push({'event': 'hs_chat_started'});
});
&amp;lt;/script&amp;gt;&lt;/PRE&gt;
&lt;P&gt;because&amp;nbsp;&lt;CODE&gt;dataLayer.push({'event': 'hs_chat_started'});&lt;/CODE&gt; only communicates with Google Tag Manager.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you wish to trigger a HubSpot event on your page, you must use &lt;A href="https://developers.hubspot.com/docs/methods/tracking_code_api/javascript_events_api" target="_self"&gt;this Events JavaScript API method&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add the following to your "New HubSpot Conversation listener" tag, after&amp;nbsp;&lt;CODE&gt;dataLayer.push({'event': 'hs_chat_started'});&lt;/CODE&gt;:&lt;/P&gt;
&lt;PRE&gt;_hsq.push(["trackEvent", {
        id: {YOUR_HS_EVENT_ID}
    }]);&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2019 14:55:37 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/307270#M29141</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2019-12-12T14:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/307815#M29212</link>
      <description>&lt;P&gt;thanks a lot&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/665"&gt;@IsaacTakushi&lt;/a&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 17:00:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/307815#M29212</guid>
      <dc:creator>RiccardoPisani</dc:creator>
      <dc:date>2019-12-16T17:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/307931#M29232</link>
      <description>&lt;P&gt;hi there&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/665"&gt;@IsaacTakushi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the script should look like this right?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;window.HubSpotConversations.on('conversationStarted', function (payload) {&lt;BR /&gt;dataLayer.push({'event': 'hs_chat_started'});&lt;BR /&gt;_hsq.push(["trackEvent", { id: {000007664686} }]);&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the id is this one, correct?&lt;/P&gt;&lt;P&gt;&lt;A href="https://monosnap.com/file/mNXJw07Hl8odRmokEaDy7vMiBhaPHB" target="_blank" rel="noopener"&gt;https://monosnap.com/file/mNXJw07Hl8odRmokEaDy7vMiBhaPHB&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still get en error on my tag&lt;/P&gt;&lt;P&gt;Tag:&amp;nbsp;&lt;A href="https://monosnap.com/file/EguNehjH7qJUIFnuIhDNW4zAgc5g1H" target="_blank" rel="noopener"&gt;https://monosnap.com/file/EguNehjH7qJUIFnuIhDNW4zAgc5g1H&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Error:&amp;nbsp;&lt;A href="https://monosnap.com/file/UTvYYRCOK0hO5JsHU3cyBR4GIG909X" target="_blank" rel="noopener"&gt;https://monosnap.com/file/UTvYYRCOK0hO5JsHU3cyBR4GIG909X&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if&amp;nbsp; I've inserted the part of the script you are suggesting in the right place.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help&lt;/P&gt;&lt;P&gt;Riccardo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 07:35:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/307931#M29232</guid>
      <dc:creator>RiccardoPisani</dc:creator>
      <dc:date>2019-12-17T07:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/308479#M29306</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/10257"&gt;@RiccardoPisani&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yep, that is the event ID, however it shouldn't be within&amp;nbsp;&lt;CODE&gt;{}&lt;/CODE&gt;; I just used those to highlight where the ID should go.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It also looks like you're missing a closing&amp;nbsp;&lt;CODE&gt;});&lt;/CODE&gt;. The combined code should be:&lt;/P&gt;
&lt;PRE&gt;window.HubSpotConversations.on('conversationStarted', function (payload) {
	dataLayer.push({'event': 'hs_chat_started'});
	_hsq.push(["trackEvent", {
		id: 000007664686
	}]);
});&lt;/PRE&gt;
&lt;P&gt;Let me know if this resolves your issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 13:49:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/308479#M29306</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2019-12-19T13:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/316456#M30279</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/665"&gt;@IsaacTakushi&lt;/a&gt;&amp;nbsp;I'm really struggling with this too, hoping you can help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to get a 'hs_chat_started' event pushed into the datalayer when a chat is initiated. I've tried your code, but it's not working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;script&amp;gt;
window.HubSpotConversations.on('conversationStarted', function (payload) {
dataLayer.push({'event': 'hs_chat_started'});
});
&amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I have a global form listener (below) which works perfectly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;script type="text/javascript"&amp;gt;
  window.addEventListener("message", function(event) {
    if(event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormSubmit') {
      window.dataLayer.push({
        'event': 'hubspot-form-success',
        'hs-form-guid': event.data.id
      });
    }
  });
&amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are trying to do the same for chat, but I can't get it to work. All I want to do is use a GTM listener to listen for the 'conversationStarted' event and then push the conversation ID into the datalayer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you able to help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 22:04:37 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/316456#M30279</guid>
      <dc:creator>stuartbrameld</dc:creator>
      <dc:date>2020-02-03T22:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/316983#M30344</link>
      <description>&lt;P&gt;I'm looking for this solution too. Help!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 16:53:39 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/316983#M30344</guid>
      <dc:creator>gabrielxyzmkt</dc:creator>
      <dc:date>2020-02-05T16:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/316986#M30345</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/118774"&gt;@gabrielxyzmkt&lt;/a&gt;&amp;nbsp;got it working yesterday, here you go &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;script type="text/javascript"&amp;gt;
  function onConversationsAPIReady() {
    //console.log("HubSpot Conversations API Available");
    window.HubSpotConversations.on( 'conversationStarted', function( payload ) {
    //console.log("HubSpot Conversation Started");
      window.dataLayer.push({
        'event': 'hubspot-conversation-started',
        'hs-conversation-id': payload.conversation.conversationId
      })
    });
  }
  /*
   If external API methods are already available, use them.
  */
  if (window.HubSpotConversations) {
    onConversationsAPIReady();
  } else {
    /*
      Otherwise, callbacks can be added to the hsConversationsOnReady on the window object.
      These callbacks will be called once the external API has been initialized.
    */
    window.hsConversationsOnReady = [onConversationsAPIReady];
  }
 &amp;lt;/script&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Feb 2020 16:57:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/316986#M30345</guid>
      <dc:creator>stuartbrameld</dc:creator>
      <dc:date>2020-02-05T16:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/317001#M30347</link>
      <description>&lt;P&gt;Friend, tell me if I did it right:&lt;/P&gt;&lt;P&gt;1 - create the listener tag as you said in All Pages&lt;BR /&gt;2 - create a trigger - custom event "hubspot-conversation-started"&lt;BR /&gt;3 - create a google ads tracking tag triggered by the "hubspot-conversation-started" trigger&lt;/P&gt;&lt;P&gt;Just this?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 17:32:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/317001#M30347</guid>
      <dc:creator>gabrielxyzmkt</dc:creator>
      <dc:date>2020-02-05T17:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/317007#M30348</link>
      <description>&lt;P&gt;Thanks so much for sharing,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/118326"&gt;@stuartbrameld&lt;/a&gt;! I was&amp;nbsp;just about to take a look at your question from Monday.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since authoring &lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/316983#M30344" target="_self"&gt;my original solution&lt;/A&gt;, I've found that it only fires if it loads after&amp;nbsp;&lt;CODE&gt;window.HubSpotConversations&lt;/CODE&gt;. This tends to be unpredictable so the if/else statement with&amp;nbsp;&lt;CODE&gt;window.hsConversationsOnReady&lt;/CODE&gt; is often a more reliable option. (This is also outlined in the API's &lt;A href="https://developers.hubspot.com/docs/methods/conversations_api/hubspot-conversations-javascript-api" target="_self"&gt;documentation&lt;/A&gt;.)&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 17:37:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/317007#M30348</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2020-02-05T17:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/317034#M30351</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/118774"&gt;@gabrielxyzmkt&lt;/a&gt;&amp;nbsp;yup that's pretty much it. this link explains how to do it for HubSpot forms, the approach is pretty much exactly the same for chat, should give you everything you need. note: the link will automatically expire in a couple of weeks&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://app.growthmethod.com/playbook/fyea0zyy9twh9gccx1dr8c50sfj20j" target="_blank"&gt;https://app.growthmethod.com/playbook/fyea0zyy9twh9gccx1dr8c50sfj20j&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 18:54:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/317034#M30351</guid>
      <dc:creator>stuartbrameld</dc:creator>
      <dc:date>2020-02-05T18:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot Livechat on Google Tag Manager</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/317215#M30384</link>
      <description>&lt;P&gt;Your code is working fine. Thanks for sharing.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 12:41:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-Livechat-on-Google-Tag-Manager/m-p/317215#M30384</guid>
      <dc:creator>gabrielxyzmkt</dc:creator>
      <dc:date>2020-02-06T12:41:45Z</dc:date>
    </item>
  </channel>
</rss>

