Referencing Program Token in Email Scripting Token
Good afternoon,
I would like to understand how to reference a Text Token within an Email Script Token, both within the same Email Program.
The Email Program contains 3 Text tokens that are used to set UTM values - {{my.UTM-Campaign}}, {{my.UTM-Source}}, & {{my.UTM-Medium}} - and each token contains a string value, e.g. em_20241113, mkto & email-organic.
These tokens are used elsewhere within the Program and email content but I would also like to utilise them in an Email Script token also within the same Program.
For context, the Email Script Token builds href URLs to be inserted into HTML, using a combination of hard coded elements, lead fields (language & country) and Product IDs, which are extracted from a SFDC Custom Product Object linked to the Person object, i.e. each person can have multiple product preferences and the email displays an image and Product name for each associated product both with the constructed URL included to allow recipients to navigate to the relevant product webpage.
Once the URL has been constructed, I want to append the UTM parameters and want to understand how those Text Tokens can be referenced within the Email Script Token.
I am currently hard-coding the values as follows and this method works when I use those variable further into the script to construct the appended UTM string:
## Set UTM values from Program tokens
#set( $utmSource = "marketo" )
#set( $utmMedium = "email-organic" )
#set( $utmCampaign = "em-reports")
## Set URL
#set( $uRLFull = "www.webpage.com/" )
#set( $uRLUTM = "?utm_source=${utmSource}&utm_medium=${utmMedium}&utm_campaign=${utmCampaign}" )
#set( $uRLBuild = "${uRLFull}${uRLUTM}" )
<a href="https://${uRLBuild}" target="_blank" style="font-weight:700; color:#16293F; text-decoration:none">
I have attempted the following approaches to retrieve the token values from the Text Program tokens but to no avail:
## 1st Attempt - Failed
#set( $utmSource = ${my.UTM-Source} )
#set( $utmMedium = ${my.UTM-Medium} )
#set( $utmCampaign = ${my.UTM-Campaign})
## 2nd Attempt - Failed
#set( $utmSource = $my.UTM-Source )
#set( $utmMedium = $my.UTM-Medium )
#set( $utmCampaign = $my.UTM-Campaign)
## 3rd Attempt - Failed
#set( $utmSource = {{my.UTM-Source}} )
#set( $utmMedium = {{my.UTM-Medium}} )
#set( $utmCampaign = {{my.UTM-Campaign}} )
Could you please advise on how I can correctly reference the 3 text Program tokens within the Email Script token and create the full required URL, including the 3 UTM parameters?
Regards