I am currently using a lead generation chatbot on my website, and I have set up a specific goal in Google Analytics to track its performance. However, I recently discovered that the goal can only be triggered when the chatbot starts and ends. The issue is that I have multiple branches in my chatbot's workflow, where people are treated differently based on certain conditions. Therefore, I don't want to track every single person who goes through the workflow.
I was wondering if it is possible to implement a custom code action that would allow me to trigger the Google Analytics goal completion at a specific point within the chat flow, rather than just at the beginning or end of the conversation.
For reference, I don't have a background in development and don't have access to a developer. If anyone could assist me with this matter, I would be extremely grateful.
Sadly, the code that runs inside a chatbot is limited to chat flow itself, which would mean it is not possible to trigger anything browser-related, so pushing data to the data layer wouldn't work either. I checked if there is a way to somehow trigger anything in the browser, but that currently is not possible. The best thing you could do is add this as an idea in the ideas forum.
Learn more about HubSpot by following me on LinkedIn or YouTube
✅ Did my answer solve your issue? Help the community by marking it as the solution.
Hi @DJohnson4 , here's an idea for a different approach. Instead of having one large chatflow with numerous branches, consider dividing your chatflow into several smaller, linear flows. Each branch transformed into simple flows with a single objective so that you can utilize conversation started and ended events to accurately report in Analytics. I hope this makes sense and you can try it out.
Martin Angeletti
HubSpot Veteran (12+ years)
❌ Worried about messing up your HubSpot? I've got your back.
✅ Join the thousands of people who have discovered how to avoid problems with simple tricks and have started to dominate HubSpot (and not be dominated).
⛅️ Don't get left behind.
→ Click the subscribe button and scroll down to find the opt-in box.
Hi @DJohnson4 , here's an idea for a different approach. Instead of having one large chatflow with numerous branches, consider dividing your chatflow into several smaller, linear flows. Each branch transformed into simple flows with a single objective so that you can utilize conversation started and ended events to accurately report in Analytics. I hope this makes sense and you can try it out.
Martin Angeletti
HubSpot Veteran (12+ years)
❌ Worried about messing up your HubSpot? I've got your back.
✅ Join the thousands of people who have discovered how to avoid problems with simple tricks and have started to dominate HubSpot (and not be dominated).
⛅️ Don't get left behind.
→ Click the subscribe button and scroll down to find the opt-in box.
Sadly, the code that runs inside a chatbot is limited to chat flow itself, which would mean it is not possible to trigger anything browser-related, so pushing data to the data layer wouldn't work either. I checked if there is a way to somehow trigger anything in the browser, but that currently is not possible. The best thing you could do is add this as an idea in the ideas forum.
Learn more about HubSpot by following me on LinkedIn or YouTube
✅ Did my answer solve your issue? Help the community by marking it as the solution.