Campaign and program tokens within an email script

Phillip_Wild
Level 9 - Champion

Campaign and program tokens within an email script

Can I access campaign and program tokens from within a script? I don't see them on the right hand side panel when I load a script token, so I don't think I can, unfortunately. And you can't use a "token within a token" so I can't simply use {{campaign.name}}.

What I'd like to do is to have an email script that each time it sends, pulls the campaign/program name and populates it within a URL parameter. Eg. http://test.example.com/?program={{campaign.name}}

But as far as I know, this won't work in a script. Only in the HTML itself.

Any ideas?

10 REPLIES 10
SanfordWhiteman
Level 10 - Community Moderator

Re: Campaign and program tokens within an email script

There's only one way to do this and it's undocumented and kinda ridiculous. Send me an email if you want to play with it.

Anonymous
Not applicable

Re: Campaign and program tokens within an email script

Hey, Sanford Whiteman ! (Happy new year!)

Any chance you could provide me with some information on this? Looking to do this for an e-mail template I'm working on.

SanfordWhiteman
Level 10 - Community Moderator

Re: Campaign and program tokens within an email script

I have your email, so I'll instructions to you... caveat marketor, as they say.

Brian_Miller3
Level 1

Re: Campaign and program tokens within an email script

I'd love to know how to do this too, for a similar purpose (embedding the campaign name in the url).

Anonymous
Not applicable

Re: Campaign and program tokens within an email script

Hi Sanford,

Would you mind sharing your solution with me too?

I am trying to do the same thing, except with multiple parameters, two of them using Person fields, and the other using {{campaign.name}}

As the OP mentioned, I have to manually append all parameters and tokens manually to the URL.

It would be helpful if I could just add any parameters to one email script token.

Jon_Yang
Level 2

Re: Campaign and program tokens within an email script

Hey Sanford,

I'd love to find out how to do this as well!

SanfordWhiteman
Level 10 - Community Moderator

Re: Campaign and program tokens within an email script

Markus_Bianchi5
Level 2

Re: Campaign and program tokens within an email script

Thanks Sanford, I just tried to access the program id using your email script in this blog post but it seems like this doesn't work in my tests. I've tried it with several Marketo instances but always got something like this:

Munchkin ID is MUNCHKIN_ID
Program ID is ${marketoSend.ProgramId}
Campaign ID is 1516
Campaign Run ID is 402
Step ID is 4211
Asset ID is 1841
Lead ID is 15

So, all other values are working fine, just the program id part is missing. Anything that I missed (the email was sent using a smart campaign within a program that I ran once)?

SanfordWhiteman
Level 10 - Community Moderator

Re: Campaign and program tokens within an email script

Check the updates at the top of https://blog.teknkl.com/accessing-ab-test-variant-from-velocity/. Unfortunately the Program ID is no longer available because of changes made in June 2019. (Well, there is an even crazier way to get at it but it's not safe enough for publication.)