0

(Full disclosure: I'm a bit of a n00b with SFDC)

I want to add Google Analytics UTM parameters to a button element on our Community (now Experience Cloud) Welcome Email. I moved the template to Visualforce, because it seems as though the regular HTML templates don't like string concatenation.

I guess I can't just hardcode the community URL, due to the specifics of the welcome email sending a token dynamically in the URL string. For whatever reason (probably due to something n00by that I'm just missing), the community URL is being stripped out. So, I'm stumped and hoping some experts can shed some light on this predicament.

  <messaging:htmlEmailBody >
    <p>some email tables and content</p>
    <!-- The Button Begin -->
    <table cellspacing="0" cellpadding="0" border="0" align="left" style="margin: 0 auto;">
      <tr>
        <td style="border-radius: 40px; background: #aac638; text-align: center;" class="button-td">
              
<!-- This was the solution I came up with, but doesn't seem to be rendering the URL -->
             <apex:outputLink value="{!$Network.NetworkUrlForUserEmails}" style="lots-of-button-styles" styleClass="button-a"> Get Started
                 <apex:param value="utm_source=email&utm_campaign=owner_activation&utm_medium=welcome+email">
                 </apex:param>
              </apex:outputLink>
      </td>
    </tr>
  </table>
  <!-- Button : END -->
  <!-- Lots more tables and email stuff -->
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

For ease and clarity, here are some of the resources I found useful in getting this far: How to get Community Url in a Visualforce email template

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_templates_creating.htm

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_network.htm

Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.