Using coded-in modules to attach UTMs to smart links

Regular Contributor

I'm experimenting more with template opportunities, specifically using smart modules in the templates themselves as opposed to within the email editor. I'm not sure if this is the best way to go about the situation, but it's something.


We often send the same email, to customers as well as leads, with slight copy changes between the two groups. One of those changes is our email footer. I'm wondering if I could make a template that uses a smart module as the footer to display either the lead footer or customer footer.


I've tested that part and it works, however, I also need to be able to add the correct UTM parameters to the respective footer links.


I'm still new to this, but I tried adding in a bit of code to the header to create a sidebar module for inputting the link, however it doesn't seem to be carrying over correctly.


This is what I've added to the header:

{% text "leads_blog_utm" label="Leads Blog UTM", value="#", export_to_template_context=True %}
{# Makes the parameters available to be stored and used in template logic #}

And I was trying to attach that to the link like this:

<div style="text-align: center;">Example of copy here<a style="color: #67a5bf; text-decoration: none;" href="{{ widget_data.leads_blog_utm.value }}"></a></div>

What part of this is not allowing the UTM to correctly pass to the link?

Is this even possible or am I trying something that really doesn't work like I'm expecting?



6 Replies 6
Community Manager

Hey @tvassalotti,


Do you have shareable links to the template/email you're working with? 


@tjoyce and @Kevin-C do you have any advice on this matter? 



Did my post help answer your query? Help the Community by marking it as a solution
Regular Contributor

I'm not sure how to create a shareable link to the template or email that isn't just a preview link. How do I create one?


Hey tvassalotti,

Also thank you @jennysowyrda


So Im rather new to HubL as well so we'll learn together, and I'll see what I can do.

@tvassalottiAre you getting any output at all? Whats the href attribute value when renderd on screen?

Regular Contributor

When I put the UTM parameter into the section in the left red box, to be appended to the links in the right red box, I had two different results for the homepage link.


When previewing it as a lead contact in the editor, I grabbed this link:



When following the link in a test email, I got this:


Edit Email   smart module testing.jpg


So basically its printing a different value than what you input?


What are the anaytics on the other end telling you about the click through? Is it registering both URLs?

Regular Contributor

Well, I think I figured it out now that you say that. There was a syntax error in the way I coded it and now it's carrying over. So, it looks like this is solved and working. Thanks for the help!