Email Script output not parsing through tracking redirect - but only for one program.

OldManRoboCop
Level 1

Email Script output not parsing through tracking redirect - but only for one program.

Hey, all!

We have a token with velocity script that outputs a URL. Now first and foremost, we know about this solution and tried it despite not creating multiple URLs within the script. It still gave us the issue we are having. We also are using the method as described here to create the output.

 

The script is working exactly as written in all other programs, but this one particular program is giving us trouble. Now, the details for you lovely folks.

 

Velocity Script:

 

## Set Array of IDs we want to ignore.
#set ( $affiliateID_array = [ "96","331","995","996","997","998","999","1000","1001","19267","18896","19305","456"] )
## Empty array for URLs (if they exist).
#set($registration_URL_array=[])

## Loop through all custom objects for the person.
#foreach($affiliate_object in $sorter.sort($affiliateRelationship_cList, "updatedAt:desc"))
	## Define this particular object ID.
	#set($affiliate_id = ${affiliate_object.affiliationID})
	
	## Does the object have an ID that matches the above exclusion array?
	#if($affiliateID_array.contains($affiliate_id))
		## If yes, do nothing, because we don't like these IDs
	#else
		## If not, check if object has a Registration URL defined.
		#if(${affiliate_object.registrationURL})
			## Registration URL found, so let's add it to an array in case there are more.
			#set ($registration_URL_found = ${affiliate_object.registrationURL})
			#set ($a = $registration_URL_array.add($registration_URL_found))
		#else
			## Registration URL was NOT found, so let's use a default one and add that to an array in case there are more.
			#set ($registration_URL_found = "default_url.com")
			#set ($a = $registration_URL_array.add($registration_URL_found))
		#end
	#end
#end

## Set output value of Registration URL and output a link.
#if($registration_URL_array.size()>0)
	## Did we add some Registration URLs above? Let's grab the most recent one.
	#set ($registration_URL = $registration_URL_array.get(0))
	<a href="https://${registration_URL}?utm_source=UTM_SOURCE&utm_medium=UTM_MEDIUM&utm_campaign=UTM_CAMPAIGN&utm_content=UTM_CONTENT" target="_blank" style="text-decoration:none; outline:none; color:#ffffff;">$registration_URL</a>
#else
	## No entries in the array? Probably no custom object that exists? Let's just do this default one instead.
	#set ($registration_URL = "default_url.com")
	<a href="https://${registration_URL}?utm_source=UTM_SOURCE&utm_medium=UTM_MEDIUM&utm_campaign=UTM_CAMPAIGN&utm_content=UTM_CONTENT" target="_blank" style="text-decoration:none; outline:none; color:#ffffff;">default_url.com</a>
#end

 


Result:

If tracking is in place, the <a> link looks perfectly fine but doesn't function properly. It will output the $registration_URL variable in the text portion of the link. But upon clicking it, the tracking redirect tries to go to "https://${registration_URL}" instead of the actual variable data.

 

If we turn tracking off by adding class="mktNoTrack" to the <a> link, it parses correctly and will go to the value of ${registration_URL}.

 

Program Details:

Email Program, created in February 2020 - Issue just discovered over the last several weeks. Unknown if it existed before then, as we inherited this project from elsewhere.

 

Extra Details:

While this exact script has been used in numerous other programs with tracking, those programs were all single-send smart campaigns, where as this one is a nurture campaign built as an Email Program. The branded domain is the same for all, and putting static links through the tracking redirects work fine.

 

 

Happy to add any other details if it'll help, and we super-appreciate the assistance ahead of time. Thanks, all!