Hi all,
I'm quite new to ACC, so I hope I'm not doing a mistake here which it to obvious...
We have a requirement to add a URL parameter to every link within an email delivery. The parameter is called "campaignId" and it's value should be set on each delivery and then appended to all links in the delivery (with the same value for all links).
So what I tried was the following:
var campaignId = delivery.variables._var[0].stringValue;
if(campaignId !== 'undefined' && campaignId.length > 0){
var deliveryUrlsLength = delivery.content.html.urlConfig.url.length;
// Loop through all URLs
for (var i = 0; i < deliveryUrlsLength; i++){
var urlSource = delivery.content.html.urlConfig.url[i].source;
if(urlSource !== 'undefined' && urlSource.length > 0){
var appendChar = "?";
// Check if the URL Source already contains at least one parameter
if(urlSource.indexOf("?") > 0){
appendChar = "&";
}
//Add the campaignId to the urlSource
delivery.content.html.urlConfig.url[i].source = urlSource + appendChar + "campaignId=" + campaignId;
delivery.content.html.urlConfig.url[i].withParams = true;
delivery.content.html.urlConfig.url[i].modified = true;
logInfo("Appended campaignId to link: " + delivery.content.html.urlConfig.url[i].source);
}
}
}
return true;
Analyze runs fine and the logInfo messages look fine as well. When sending the mails, links are rewritten for targeting, but when clicking the links, the campaignId parameter is not appended.
Any hints on what I'm doing wrong? Is this the correct approach at all?
Thanks for your input!
BR
Sebastian
Solved! Go to Solution.
Views
Replies
Total Likes
David's option might be cleaner, but this is how we did it : We created a 'web analytics' external account and added our custom url parameters in the tracked URL calculation as shown below. We have also integrated our Analytics account to Campaign with the option below that, but I think you can just skip that if you don't need it?
You will then be able to select this external account in the 'web analytics' tab of your deliveries. Every delivery with this account linked will change all tracked URLs as defined in that external account.
Again, you can ignore the fields below the account selection. I would also reccommend adding a field in the campaign's input form to add your campaignId instead of using variables, which will make it easier to fetch in the script.
Kr,
Xavier
Hi Sebastian,
Add a logInfo(campaignId) to see if your variable is set up correctly.
Another way ( i think easier to achieve this) is to update NmsTracking_ClickFormula option.
Thanks,
David
Views
Replies
Total Likes
David's option might be cleaner, but this is how we did it : We created a 'web analytics' external account and added our custom url parameters in the tracked URL calculation as shown below. We have also integrated our Analytics account to Campaign with the option below that, but I think you can just skip that if you don't need it?
You will then be able to select this external account in the 'web analytics' tab of your deliveries. Every delivery with this account linked will change all tracked URLs as defined in that external account.
Again, you can ignore the fields below the account selection. I would also reccommend adding a field in the campaign's input form to add your campaignId instead of using variables, which will make it easier to fetch in the script.
Kr,
Xavier
Views
Replies
Total Likes