Anchor Link Scroll Effect Using a Hubspot CTA

Highlighted
Occasional Contributor

Hi, Im trying to add a link to a cta button so that when clicked the page scrolls. Unfortunatly in the cta edit I need to add a valid URL protocol to the link field. I can only add the whole url which forces the page to reload to the anchor point rather than allowing me to just add #anchorname into the link field.

Is there any way that I can use hubspot cta buttons to call a #anchorname only?

3 Replies
Advisor

Is there a reason your trying to use a CTA for this  vs a regular HTML anchor tag? CTA's are used to track views, clicks and submissions for converstion analytics. I don't see a whole lot of value using a CTA over a standard HTML anchor link for in-page navigation.

HubSpot Employee

@ndwilliams3 I would completely agree! Unless you had a specific reason for doing so, I wouldn't think that a page navigation would need to be built with CTAs. @Woodsy I don't believe that you can use relative URLs in the CTA tool but you can follow along with the instructions in this Academy article (https://knowledge.hubspot.com/articles/kcs_article/cta/can-i-use-an-anchor-id-in-the-url-link-of-a-h...) to add an anchor ID to the end of an absolute URL. 

New Contributor

What about the case of a single page application or a long single-page site with scrolling navigation? It also seems that it's not possible to handle the click of a CTA with a script in a way that allows the tracking functionality to be passed. It's severely limiting that CTA buttons can only be used to navigate to a different page. It is possible to use the hash navigation, but then you are still reloading the page and have the odd "jump" effect. Having the ability to send the tracking via a script API and handle the click, or at least the ability to use a relative URL would be incredibly useful in terms of flexibility.