Navigation überspringen

[Gelöst] I need to be able to add an alt tag to a dynamic link

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

I want to track clicks on members’ names (linked to their profile pages) using Google Tag Manager by referencing an alt tag, but I can’t add an alt tag to the clickable post title generated by [wpv-post-link].

Solution:

Replace [wpv-post-link] with a custom HTML anchor tag using [wpv-post-url] for the href and [wpv-post-title] for the link text. This allows adding any custom attribute (like alt or data- tags) that GTM can read:
[wpv-post-title]

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-url

This support ticket is created vor 7 months, 1 week. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Dieses Thema enthält 1 reply, hat 1 Stimme.

Zuletzt aktualisiert von brianC-15 vor 7 months, 1 week.

Assistiert von: Christopher Amirian.

Author
Artikel
#2829290

Tell us what you are trying to do?
My website is a directory and it is important that I can give data to those members on the number of times their image or the name (linked to their profile page) is clicked on. I use Google Tag Manager and I have set up the trigger to be linked to the 'alt tag' of the text link. I have successfully set this up for the image when clicked but I can't see how to add an alt tag to a post litle with link which is the field used for the clickabel link above the members profile image.

Is there any documentation that you are following?
Not that I can find

Is there a similar example that we can see?
Yes I do this on my other websites citytherapyrooms.co.uk on the home page you will see all the therapists images and below them is the name (linked) to their profile page and each name has an Alt Tag associated with the specific therapist and this triggers an 'event' in GTM

What is the link to your site?
versteckter Link

#2829294

Christopher Amirian
Unterstützer

Sprachen: Englisch (English )

Hi,

Welcome to Toolset support. You will need to use shortcodes and HTML code for that.

Replace [wpv-post-link] with a custom <a> so you can add attributes GTM can read:

<em><u>versteckter Link</u></em>

Make sure you use [wpv-post-url] for the HREF attribute of the anchor tag instead of [wpv-post-link].

Thanks.

#2829295

Thanks Christopher

I'll give that a go