unless you really need the CTA (function) I would go with a custom button module.
The most basic custom button module contains:
Link function
text function (name: Button label; not rich-text)
and looks like this:
{% set href = module.link_field.url.href %}
{% if module.link_field.url.type is equalto "EMAIL_ADDRESS" %}
{% set href = "mailto:" + href %}
{% endif %}
<a href="{{ href }}" {% if module.link_field.open_in_new_tab %}target="_blank"{% endif %}{% if module.link_field.rel %}rel="{{ module.link_field.rel }}"{% endif %}>
{{ module.button_label }}
</a>
you can expend it to your needs. Since you want to add GTM parameters/tags to it you can add another text field called "Google tag"(feel free to rename it) like it
{% set href = module.link_field.url.href %}
{% if module.link_field.url.type is equalto "EMAIL_ADDRESS" %}
{% set href = "mailto:" + href %}
{% endif %}
<a href="{{ href }}" {% if module.link_field.open_in_new_tab %}target="_blank"{% endif %}{% if module.link_field.rel %}rel="{{ module.link_field.rel }}"{% endif %} id="{{ module.google_tag }}">
{{ module.button_label }}
</a>
if you want to add CSS classes you have several ways. My recommendations are:
the code for choice and text fields looks like this
{% set href = module.link_field.url.href %}
{% if module.link_field.url.type is equalto "EMAIL_ADDRESS" %}
{% set href = "mailto:" + href %}
{% endif %}
<a href="{{ href }}" {% if module.link_field.open_in_new_tab %}target="_blank"{% endif %}{% if module.link_field.rel %}rel="{{ module.link_field.rel }}"{% endif %} id="{{ module.google_tag }}" class="{{ module.css_class }}">
{{ module.button_label }}
</a>
for booleans like this
{% set href = module.link_field.url.href %}
{% if module.link_field.url.type is equalto "EMAIL_ADDRESS" %}
{% set href = "mailto:" + href %}
{% endif %}
<a href="{{ href }}" {% if module.link_field.open_in_new_tab %}target="_blank"{% endif %}{% if module.link_field.rel %}rel="{{ module.link_field.rel }}"{% endif %} id="{{ module.google_tag }}" class="btn {% if module.secondary_button %}secondary{% endif %}">
{{ module.button_label }}
</a>
There are almost no limitations how many options you'd like to add. If you don't have experience in custom module development - take a look how/where to start here in the docs
Thank you very much for your reply, but it is probably not the solution to my problem.
I want to use the hubspot CTA code and add it in Google Tag Manger. I want to add this via GTM because I do not have access to the code of this page and this is the only option. This is how (via javascript) adds a popup at the moment. And in a similar way, I wanted to do it by adding the 'split' CTA code: https://prnt.sc/lEv7Pzl0PryV Works, but unfortunately statistics are not counted: https://prnt.sc/_9AiN5pA7cA8
Adding the code blocks you indicated is rather impossible in GTM - errors appear and the tag does not fire at all.
I suspect, therefore, that such 'splitting' the CTA code and adding it in parts via js does not work and hubspot does not ensure correctness and support for such an operation.
no problem - to get it right: You're placing the id from the img(CTA) to the GTM, right?
If so - is the GTM script loaded in the header or footer? I only can assume that if the GTM is loaded after the CTA script it might not get the code but maybe I'm completly off.
So if your GTM code is - for some reason - in the footer area, try moving it to the header area
But looking at what you write, I have to add one more thing - I don't know if it is important: the trigger in GTM that fires this tag (with the coded CTA as above) is to scroll to 60% of the article / this page - then it appears: https://prnt.sc/ZLFx4NaOTQ9J
(There's another one that fires on an exit attempt - but that's not what I'm doing at the moment).