2

I have integrated the HubSpot chat function in our website using GTM. It works all fine.

The issue here is that I want the chat to be hidden on our checkout page(due to some reason).

Here's how I have it configured now:

A custom pageview event occurs on all pages except the checkout page. This event is used to create a trigger CustEv-pageview. This trigger is used to activate the Hubspot chat tag.

Now, since the trigger doesn't fire on checkout page, the tag isn't activated and the Hubspot code should not be included in the section but it is.

And the chat widget is visible.

However, if I refresh the page the Hubspot code and the chat widget both disappear.

We use Nuxt.JS for our front-end.

Here are some screenshots.

Tag configuration. enter image description here

When we move from a product page to the checkout page. enter image description here

After refreshing the checkout page. enter image description here

1

To answer perfectly, I'd need to know: What are the details of the custom event you have triggering this and the custom event you have as an exception? Are these custom events going to be affected by any AJAX/Lazy Loading you're implementing?

However, you can simplify things. Instead of your custom events, trigger the Custom HTML tag using the DOM Ready trigger built into Tag Manager, and then add an exception for the page you don't want it to appear on. Thusly.

Google Tag Manager Screenshot

If there are any other pages you want to exclude, you can simply add them as additional exclusions in the same way.

  • I can't use DOM as we use Nuxt and DOM is fired once and as we move to the next page, there is no DOM unless we refresh that page so that is out of the equation. To compensate for this, Nuxt throws an event(pageview) every time we move from one page to another for the pages where it is enabled. This custom event is used to define a trigger which activates the tag. – Anuvesh Nov 5 at 12:20
  • Since pages are rendered on the client-side, if I move from a product page to the checkout page, the <head> doesn't change. But if I refresh the checkout page, it is rendered on the Server-side hence <head> is reset so there is no Hubspot script in the <head> and since the tag is not fired on this page, it is not added via GTM tags. – Anuvesh Nov 5 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.