How to change tracking type value in delivery using JS in adobe Campaign classic | Community
Skip to main content
Level 2
April 23, 2024
Solved

How to change tracking type value in delivery using JS in adobe Campaign classic

  • April 23, 2024
  • 1 reply
  • 1534 views

Hi Experts,

I have requirement to update Tracking Type to the URLs in Email HTML, for around 300 the email deliveries.

I checked in the delivery the tracking is Enabled, the value is "0"[Zero] or other values.

Now I want to update with Value as"1" [Not tracked].

So, anyone can help me on this.

Thank you.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by iSantoshk

Hi @isantoshk,

 

You can do something like this:

var delivery = nms.delivery.load(1234); var urls = delivery.content.html.urlConfig.url.length; //looping through all URLs in urlConfig for (var i = 0; i < urls; i++){ delivery.content.html.urlConfig.url[i].trackingType = 1; } delivery.save();

BR,

Ishan


Hi @isahore ,

Thank you for your time, its really appreciated.

 

Its WORKING now.

Here the my updated Code for multiple Delivery templates update.


// Definign Empty Array for Delivery Templates Ids

var templateIds = [];

//creating Query to get Delivery templateIds

var query = xtk.queryDef.create(

<queryDef schema="nms:delivery" operation ="select">

<select>

<node expr="@id"/> // selecting Primary Keys from Delivery Schema

</select>

<where>
<condition expr="@internalName LIKE '%DM%'" bool-operator="AND"/>
<condition expr="@messageType = '0'"/> // checking only Email Channel Deliveries and more conditions based on your requirment.
</where>

<orderBy>
<node expr="@id" sortDesc="true"/> // we can orderBy based your requirment using expr value.
</orderBy>

</queryDef>);

var tResult = query.ExecuteQuery();

var tCount = tResult.delivery.length();

logInfo("Templates Count:"+ tCount);

var calltArray = tArray(); // Caling Fucntion for Create TemplateIDs Array with delivery @Ids

// defining Function for creating Array

function tArray(){

//Looping all the Delivery Ids

for(var i=0; i<tCount; i++)

{

templateIds.push(parseInt(tResult[i].@id));

}

logInfo("templateIds: " + templateIds);

return;

}


//looping through all Delivery in TemplateIds

for (var j = 0; j < templateIds.length; j++){

var delivery = nms.delivery.load(templateIds[j]);

var urls = delivery.content.html.urlConfig.url.length;

logInfo("URLs Count: " + urls );

//looping through all URLs in urlConfig

for (var k= 0; k < urls; k++){

//logInfo("TrackingTye before Update " + delivery.content.html.urlConfig.url[k].trackingType);

if(delivery.content.html.urlConfig.url[k].trackingType === 0) // accessing only Enabled Traking Type URLs with value "1"

{

var updatedTType = delivery.content.html.urlConfig.url[k].trackingType = 1; // updating as Not Tracked with value "1"

}

}
delivery.save();

logInfo( "TrackingTye after Update " + updatedTType);

}

logInfo("Tracking type updated for " +tCount+ " all email templates");

 

Thank you,

Santosh

1 reply

Manoj_Kumar
Community Advisor
Community Advisor
April 23, 2024

Hello @isantoshk 

 

if these are delivery templates then you can select all and then perform a mass update.

 

Here is a documentation on how to use this feature: https://experienceleague.adobe.com/en/docs/campaign-classic/using/getting-started/profile-management/updating-data#performing-a-mass-update

Manoj     Find me on LinkedIn
iSantoshkAuthor
Level 2
April 23, 2024

Hi @_manoj_kumar_,

Thanks for your reply.

But I want to update the each URL in HTML content under each delivery.

Like, I want to update the node of delivery.content.html.urlConfig.url.@trackingType. under each delivery HTML content.

attaching screenshot for reference.

Thank you.