Avatar

Level 3

Hi,

 

We are using web analytics account to add UTM tags. In Email delivery we are using newsletter defined in the publication template. In template there are multiple buttons and URL are configured. Our requirement is too add utm tags with custom attribute. I have added below code in the Web analytics external Account. When I click the link or button present  in the email I can see the UTM tags in the URL.

 

 

<%@ include option='NmsTracking_ClickFormula' %><% // Parameters expected by Adobe Analytics Data Connector
var pattern = new RegExp("(www)", 'i')
var mtype= message.delivery.messageType;
if( $(urlstring).match(pattern) && delivery.FCP == false && mtype==0)
{
%>&utm_source=abc&utm_medium=email&utm_campaign=<%= message.delivery.customAttribute %><% }
else
{%>
&utm_source=abc&utm_medium=sms&utm_campaign=<%= message.delivery.customAttribute %>
<% }%>

 

The new requirement is, if the customer clicks button in the email then UTM content should display  as button. If Link is clicked then UTM content should be displayed as link in the URL.

Example for

button: www.google.se?utm_source=abc&utm_medium=email&utm_campaign=Abc&utm_content=button

Link: www.google.se?utm_source=abc&utm_medium=email&utm_campaign=Abc&utm_content=link

Could any one please guide me how to achieve this.

 

Thanks in advance.

Ram.