function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anusha KasaragaddaAnusha Kasaragadda 

Slower send speed due to SSJS link Tracking (in larger sends )

Context:
We use data extension to store email content and we have an Amp script that runs for each email trigger.
Amp script contains couple of placeholder replacement logic and link tracking SSJS script.

Problem Statement:
SSJS code block in our script is to place redirectTo function around each link to track the links in an mail.
This is particularly giving problem, due to this SSJS code block , large sends are taking time to finish.

Sollutions Tried:
we tried optimizing the SSJS link tracking script, but it is not getting better.
Instead of SSJS script, we wraped our content around TreatAsContentArea(), but this has limitation for 300 unique links , and it is not working.
Sample script we have:
%%[
SET @Full_Email_Html = /*Here is the code that gets content from DE and run some replacements*/
SET @Full_Email_Html = TreatAsContent(@Full_Email_Html);
]%%
<script runat=server>
Platform.Load('core','1');
function TrackLinksHTML(f){
if(f.indexOf('@')==0){
f=Variable.GetValue(f)
}
var g=f.match(/<a.*?href=["'].*?["'].*?>/i);
var h=f.split(/<a.*?href=["'].*?["'].*?>/i);
for(var i=0;i<g.length;i++){
Variable.SetValue('@a',g[i].match(/href=["'].*?["']/i)[0].replace(/href=["'](.*?)["']/i,'$1'));
Variable.SetValue('@b',g[i].match(/<a.*?href/i)[0].replace(/<a(.*?)href/i,'$1'));
Variable.SetValue('@c',g[i].match(/href=["'].*?["'].*?>/i)[0].replace(/href=["'].*?["'](.*?)>/i,'$1'));
Variable.SetValue('@d',h[i]);
</script>
%%=v(@d)=%%
<a %%=v(@b)=%% href="%%=RedirectTo(@a)=%%" %%=v(@c)=%%>
<script runat=server>}Variable.SetValue('@e',h[i]);</script>
%%=v(@e)=%%
<script runat=server>}</script>
<script runat="server"> TrackLinksHTML("@Full_Email_Html"); </script>

Questions:
"optimizing SSJS" or "TreatAsContentArea" are out of scope for us.
Are there any other alternatives for link tracking?

We tried with content builder , but it could not be used for tigger send and user intiated emails(like through api).It's only useful for manual send
 
SwethaSwetha (Salesforce Developers) 
HI Anusha,
The details in the question are very clear. You can reach out to Success - Salesforce Marketing Cloud page on https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F9300000001pQ5CAI for better visibility and inputs on your ask.
 
You can also log a case with salesforce support.
Link: https://help.salesforce.com/articleView?id=workcom_contact_support.htm&type=5
 
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Anusha KasaragaddaAnusha Kasaragadda

Hi Swetha,

we already had discussion with salesforce support , but we didn't get exact solution for this issue.
I am unable to access this link which you posted in the comment.

https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F9300000001pQ5CAI

SwethaSwetha (Salesforce Developers) 
HI Anusha,
Try https://trailhead.salesforce.com/trailblazer-community/groups/0F9300000001pQ5CAI?tab=discussion

If this information helps, please mark the answer as best. Thank you