Expand my Community achievements bar.

Applications for the Community Advisor Program Class of 2025 are NOW OPEN – Apply Today!

I need to add Sourcetag in Email Delivery when sending targeted e-mails through Adobe Campaign classic in click formula NmsTracking_ClickFormula_email

Avatar

Level 5

 

Hi team,

I have a requirement where we have to add sourcetags in Email Deliverywhen sending targeted e-mails through Adobe Campaign Classic in click formula 

NmsTracking_ClickFormula

please help me to understand where we can add sourcetags in NmsTracking_ClickFormula under Platform->options

Alternatively, can we create typology rule

that loops over all the URL in delivery and add the as the source tag

-->PLEASE GUIDE ME ON THIS PART

 

Please let me know where and how  to add the source tag to all the urls in email delivery in order to Analytics to track it 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

6 Replies

Avatar

Level 7

Hi @Shruti1,

 

It would be more practical, to create a typology rule, cause it is more flexible and allows you to process all URLs dynamically within the email content before sending or you can modify the NmsTracking_Clickormula).

 

Applying JavaScript you can do it, defining the variables and a for to loop trough each link and append the sourcetag.

 

If you need more help, just let me know.

 

Regards,

Celia

Avatar

Level 4

Hello @ccg1706

 

I also need to work on same requirement:

 

I need, to create a typology rule, and which allows you to process all URLs dynamically within the email content before sending

Applying JavaScript you can do it, defining the variables and a for to loop trough each link and append the sourcetag.

my source tag is: For FB: SOURCETAG=C0030P3000A99P0000F0000MCD0

can u help me with the code for typology rule for this please

 

also second method:

where we can modify the NmsTracking_Clickormula, can u give me the code for this NmsTracking_Clickormula-modified with addition of sourcetag

 

 

 

Avatar

Level 7

Hi @DishaSharma,

 

Try with the following codes:

 

For method 1: (typology rule)

//  Time to add that SOURCETAG magic to all URLs in the email before sending 

// Define our special source tag for FB 
var sourcetag = "SOURCETAG=C0030P3000A99P0000F0000MCD0";

// Loop through all the URLs in the email content 
for each (var url in delivery.content.html.links) {
    
    var linkUrl = url.url; // Grab the current URL

    // If it doesn't have a ?, we add one. Otherwise, we slap on an &
    linkUrl += (linkUrl.indexOf("?") === -1) ? "?" + sourcetag : "&" + sourcetag;

    // Update the link with our new fancy tracked version ️
    url.url = linkUrl;
}

// Log the operation 
logInfo(" SOURCETAG successfully added to all URLs in this email. ");

 

For method 2: (Adding Source tag)

//  Let’s make sure our links are tracked when clicked! 

// Grab the original URL (the one without our magic yet)
var url = event.getUrl();

// Our FB source tag 
var sourcetag = "SOURCETAG=C0030P3000A99P0000F0000MCD0";

// Time to make it sparkle 
url += (url.indexOf("?") === -1) ? "?" + sourcetag : "&" + sourcetag;

// Return our beautifully modified URL 
return url;

 

Let me know if you need more assistance.

 

Kind regards,

Celia

 

Avatar

Level 4

hello @ccg1706 

thanks for u reply

below is NmsTracking_ClickFormula:

 

 

<% if( typeof strPurlTrackingServer!="undefined" && strPurlTrackingServer.toString() ) { %><%= strPurlTrackingServer %><% } else { %><%@ include option='NmsTracking_ServerUrl' %><% } %>/r/?id=<%=
type.substr(0, 1) %><% if( typeof(message.id) === 'string' ) { %><%= message.id %><% }
else { %><%= (message.id<0 ? (message.id+4294967296) : message.id).toString(16).toLowerCase() %><% }
%>,<%@ value object="delivery" xpath="@idTracking" %>,<%= escapeUrl("$(urlId)") %>

<%
if (document.mode == "forward")
{
var d = message.getParameter("d")
if( d )
d = d.split(",")
%>&ap_visitorId=<%=message.getParameter("visitorId") != '' ? message.getParameter("visitorId"):0 %>&ap_category=<%= d[0]?d[0]:'' %>&ap_deliveryId=<%=d[1]?parseInt(d[1],16):0%><%
} %><%
if( typeof proposition != "undefined" && proposition.length == undefined )
{ %>&ap_oid=<%= ( proposition.offer.id && proposition.offer.id != 0 ) ? proposition.offer.id : proposition.offer_id %><%
} %>

 

 

could you please help to let me know where exactly i should put the code which u mentioned above..please

awaiting ur reply

Avatar

Level 4

Hello@ccg1706

 

I tried this but its not working could you please help me where exaclty after which line of code in NmsTrackingClick formula,

I should add your code

 

//  Let’s make sure our links are tracked when clicked! 

// Grab the original URL (the one without our magic yet)
var url = event.getUrl();

// Our FB source tag 
var sourcetag = "SOURCETAG=C0030P3000A99P0000F0000MCD0";

// Time to make it sparkle 
url += (url.indexOf("?") === -1) ? "?" + sourcetag : "&" + sourcetag;

// Return our beautifully modified URL 
return url;

 

Avatar

Level 5

Hello@ccg1706

Please help me with correct code..