Expand my Community achievements bar.

SOLVED

Where to add Sourcetag in Email Delivery when sending targeted e-mails through Adobe Campaign classic

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

 

please help me to understand where we can add sourcetags in Email Deliverywhen sending targeted e-mails through Adobe Campaign Classic

 

Please let me know wheere and how  to add it  to all the links to the website in order to Analytics to track it 

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @DishaSharma,

// Define the source tag
var sourceTag = "E00040S3000D99908";

// Ensure the email content is accessible
if (message && message.content && message.content.html && message.content.html.source) {
    var htmlContent = message.content.html.source; // Get the email HTML content

    // Convert email HTML to lowercase to avoid case sensitivity issues
    var modifiedContent = htmlContent.replace(/href="([^"]*?)"/gi, function(match, url) {
        if (url.indexOf("source=") === -1) { // Check if 'source=' already exists
            var separator = url.indexOf("?") > -1 ? "&" : "?";
            return 'href="' + url + separator + "source=" + sourceTag + '"';
        }
        return match; // Return unchanged if 'source=' is already present
    });

    // Log modified content for debugging
    logInfo("Updated Email HTML: " + modifiedContent.substring(0, 500)); // Log first 500 characters to avoid truncation

    // Update the email content with the modified version
    message.content.html.source = modifiedContent;
}

Try with these, additionally run it in a workflow before using it in a typology rule. If again fails you will have to open  a ticket to support sharing the error and your typology rule details.

 

Regards, 

Celia

 

 

 

View solution in original post

22 Replies

Avatar

Level 4

Hi @Shruti1, as per my understanding the ask is to add source value in the tracking URLs of the instance.

You can modify the default formula for tracking (Admin->Platform->Options->NmsTracking_ClickFormula) 

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

 The output for the above would look like this:-

https://trackingserver.com/r/?id=e3f5c256789abc123&source=newsletter_march&ap_visitorId=1001&ap_cate...

 

I hope this helps,

 

Regards,

Abhinav

Avatar

Level 4

Hello @abhinav99 

 

 

I have tried the code which u mentioned but no luck,, i cant see appended source tag in URL of email...

please help me with correct code,i really need it asap