I have search the documents for this but maybe I am searching using the wrong terms as I can’t seem to find an answer.
The issue is that I have set up a Hero module which has a selector for a Hubspot html/text CTA for a button or a text link for a button. They are styled to look the same unless the user adjusts the Hubspot CTA styling settings. The idea is that the Hubspot CTA has it’s tracking code and button image while the user can set a second button that doesn’t require a CTA to be first set up and can be a link to an anchor elsewhere on the page like a form, or a file download, or to an external page.
The first option, a Hubspot CTA works as expected. The second option, a text link button works as expected on a portal that does not Hubspot Tracking active. So I get just the link on the button that I expect. Now on a portal with Hubspot tracking active, I get the link I expect and a second later, the javascript runs and I get a tracking code inserted into the link’s URL.
For example:
On this page I have 2 CTAs. Hubspot Onboarding
The first is a Hubspot CTA. The second is a text link Button.
The second link ends up being:
https://www.kayakmarketing.com/hubspot-onboarding?__hstc=226077637.548bcec11defd5c902a60be0b010d8a7.1713398452742.1723767898549.1723816281112.18&__hssc=226077637.1.1723816281112&__hsfp=879966569&hsutk=548bcec11defd5c902a60be0b010d8a7&contentType=standard-page#onboarding
I am only looking for it to be a link to an anchor:
https://www.kayakmarketing.com/hubspot-onboarding#onboarding
Clicking the link brings me to the anchor but the page flashes as the browser first goes to the tracking page and then back to the onboarding page. Sometimes it is fast and barely noticeable and sometimes it takes a second or two and is bothersome to say the least.
At the bottom of the page, there is a form and beside the form are links that have this extra code and some that don’t. These are inline links and the only difference I see is that the one’s with the tracking code is to other Hubspot pages and the one’s without are to internal pages. Same with the footer, these do not have this code.
So I was thinking it had something to do with my code that handles this.
In selecting a text link instead of a CTA, I use the URL and Link fields ( URL and Link fields now available in Custom Modules ). There is a set of if statements to generate whether the button is a Hubspot CTA or Text.
Originally I did not include the elif statement to check if is equal to external. This was added to test how I can maybe remove the insertion of the tracking code. If I set it to Email, the url generated also includes the tracking code.
If I remove the elif statement and just put {% set href=‘onboarding’ %} which ignores the URL content selector all together, I still get the URL with tracking code above.
{% if module.secondary_cta_type != 'none' %}<div class="button-cta secondary {% if module.secondary_cta_type is equalto 'text' %}textbutton{% endif %}">{% if module.secondary_cta_type is equalto 'text' %} {% if module.secondary_button_url.url.type is equalto "EXTERNAL" %} {% set href2 = module.secondary_button_url.url.href %} {% elif module.secondary_button_url.url.type is equalto "EMAIL_ADDRESS" %} {% set href2 = 'mailto:' + module.secondary_button_url.url.href %} {% else %} {% set href2 = module.secondary_button_url.url.href %} {% endif %} <a href="{{ href2 }}" class="cta_button textbuttona" title="{{ module.secondary_cta_button_text }}" {% if module.secondary_button_url.open_in_new_tab %}target="_blank"{% endif %} {% if module.secondary_button_url.rel %}rel="{{ module.secondary_button_url.rel }}"{% endif %} >{{ module.secondary_cta_button_text }}</a>{% else %} {% cta guid="{{ module.secondary_cta }}" %}{% endif %}</div>{% endif %}
So, is there something that I can do to the hubl code that can make the tracking javascript ignore this text button and not add the tracking code to it?