Re: Velocity token only to append UTMs to URL

lianef
Level 2

Hello, 

I'm not sure if I posted this in the right discussion forum but I am looking to use a velocity token in my CTA urls to append UTMs. 
The issue I am facing is the mkt_tok value appending prior to the token values and then the entire velocity script appends at the end. 

The reason behind using the velocity token is a request and we have dual layer segmentation in the emails but need this third layer via velocity to indicate where the user clicked, what region, which product  etc. 
The velocity token looks at a product tag and a region segmentation membership. 

Mostly just wondering if anyone can help me understand why the mkt_tok is appearing before the velocity token and why the velocity token isn't running. 
It works in previewing the email in marketo but not in my inbox. 

HTML for CTA

<a class="whiteText" href="https://www.example.com/fh/files/misc/example.pdf{{my.utm_string}}" target="_blank" style="font-family: 'Arial','Noto Sans JP',Arial,sans-serif; color: #ffffff; text-decoration: none; font-size: 14px; letter-spacing: 1px; font-weight: bold; -webkit-border-radius: 4px; border-radius: 4px; border: 1px solid #1a73e8; margin: 0; padding: 14px 16px 14px 16px; display: inline-block;">Example CTA</a>

Just a piece of the velocity token {{my.utm_string}} as its very large

#elseif (${lead.eP_40034_Tag} == "PRODUCT1" && ${lead.Segmentation_Region_1003} == "EMEA") 
?utm_source=cloud_sfdc&utm_medium=email&utm_campaign=EXAMPLE&utm_content=emea-q3-email1-PRODUCT1&utm_term=
#elseif (${lead.eP_40034_Tag} == "PRODUCT1" && ${lead.Segmentation_Region_1003} == "LATAM") 
?utm_source=cloud_sfdc&utm_medium=email&utm_campaign=EXAMPLE&utm_content=latam-q3-email1-PRODUCT1&utm_term=
#elseif (${lead.eP_40034_Tag} == "PRODUCT1" && ${lead.Segmentation_Region_1003} == "NORTHAM") 
?utm_source=cloud_sfdc&utm_medium=email&utm_campaign=EXAMPLE&utm_content=northam-q3-email1-PRODUCT1&utm_term=
#else
?utm_source=cloud_sfdc&utm_medium=email&utm_campaign=EXAMPLE&utm_content=default-q3-email1-PRODUCT1&utm_term=
#end




Tags (1)
2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

You can't output only parts of a URL from Velocity unless you set the link to untracked. (This has been discussed in tons of past threads if you search.)

If the link is to be tracked, you must output the entire <a> tag (through the closing </a> from Velocity.

lianef
Level 2

Thank you @SanfordWhiteman 🙂
I had seen some similar posts but I had removed tracking and was still having trouble which I realize I should have added to my original post. 
I was also trying to avoid having to write a lengthy velocity script but I'll do a test and I will adjust my velocity to incorporate the entire <a> tag though and see what happens. 

I really appreciate your response. have a great day!