Re: Capture link ID directly from an <a> tag?

FrizzyBrain
Level 2

Capture link ID directly from an <a> tag?

Hello is it possible to use the report feature to track an id from an <a> tag? I know that if I were to add a link inside a rich text editor, I was able to add an ID of a link (based on this post) and it would capture the ID in a report. Then I was able to filter the data based on that ID.

 

Now I want to do this to a button made from an <a> tag. The code is below.

 

 

<a class="blue-btn" href="${CTALinkA5}" style="background-color:${CTABkColorA5};border:2px solid ${CTABorderColorA5};border-radius:8px;color:${CTACopyColorA5};display:inline-block; font-family: 'Montserrat', sans-serif; font-size:18px; font-weight:500; line-height:42px;text-align:center;text-decoration:none;width:${CTAWidthA5}px;-webkit-text-size-adjust:none;mso-hide:all;" id="${CTAEmailRef}">${CTACopyA5}</a></div>

 

 

Is it possible?

 

8 REPLIES 8
SanfordWhiteman
Level 10 - Community Moderator

Re: Capture link ID directly from an <a> tag?

Any tracked link should be constrainable by its id attribute.

FrizzyBrain
Level 2

Re: Capture link ID directly from an <a> tag?

Okay so we created an email and have sent it to testers to click on a link inside a rich text editor v.s. a link directly from an <a> tag. Below are the query conditions that we have added:

FrizzyBrain_0-1692251113991.png

 

Both links had two different IDs with the same href links. If we look for the link ID that was inside the rich text editor, it would show data. But if we look for the link ID that was in the <a> tag, it would not show data.

 

What are we missing?

SanfordWhiteman
Level 10 - Community Moderator

Re: Capture link ID directly from an <a> tag?

Can you look for a link with the literal value in your template (${CTAEmailRef})?

 

If this exists you have an order-of-operations problem specifically because you’re using a variable.

FrizzyBrain
Level 2

Re: Capture link ID directly from an <a> tag?

The literal value that I've added inside '${CTAEmailRef}' is 'btn' and it isn't populating any data. Without adding the 'link ID' parameter, that is when it shows results in all links that has been clicked on that email.

 

Is this a case you've come across?

SanfordWhiteman
Level 10 - Community Moderator

Re: Capture link ID directly from an <a> tag?

No, the literal value in the template is the variable name (before being interpolated into the variable's value set at the email level).

That's why I'm asking you to look for the variable name — i.e. the ${mktoVariable} syntax — as the Link ID, as if Marketo were only seeing the template HTML.

FrizzyBrain
Level 2

Re: Capture link ID directly from an <a> tag?

No, the data doesn't populate using the variable name as well. 

 

Is there an unconventional way that I could go about with capturing link IDs? I've thought about adding query parameters inside the links to differentiate them.

FrizzyBrain
Level 2

Re: Capture link ID directly from an <a> tag?

It looks like adding query parameters to the link is the only way that I found to capture direct links inside an <a> tag. 

FrizzyBrain_0-1692311493853.png

We'll just have to give up it for now. Thank your for your time.

SanfordWhiteman
Level 10 - Community Moderator

Re: Capture link ID directly from an <a> tag?

My findings don’t agree with yours.

 

When I set this in the template:

<meta class="mktoString" id="link1" mktoname="Link 1" default="www.example.com" />
<meta class="mktoString" id="linkId1" mktoname="Link ID 1" default="my-id" />
<a href="https://${link1}" id="${linkId1}">GO</a>

 

And set values in the email asset:

SanfordWhiteman_2-1692331705866.png

 

I’m able to see the Link ID in the log:

SanfordWhiteman_1-1692331572664.png

 

And filter on it in a Smart List:

SanfordWhiteman_0-1692331561018.png

 

SanfordWhiteman_4-1692331784949.png