Modify Tracking URL

Darren_Bowers

MVP

09-06-2020

We have a requirement to modify the tracking URL that is generated in the system. We are integrating in with Branch.io and iOS requires that we be able to mask out "web only" tracked URLs somehow. The only way we can do this is modifying the auto-generated tracking URL to show a different path in the tracked URL

e.g. currently the tracking URL generates something like:

https://[tracking_host]/r/?id=h458d142,3fdc02a,36d17c3&cid=...

What we would like to do is for certain URL parameters, change the URL to:

https://[tracking_host]/web/?id=h11b2848,a69a2ad,9ff689e&cid=...

I can see the script where the tracking URL is generated, but how do we modify the tracking scripts to process the new /web/ path?

We are also on an Adobe-hosted server model if that changes things

Any guidance would be appreciated!

 

 

Accepted Solutions (1)

Accepted Solutions (1)

_Manoj_Kumar

MVP

10-06-2020

Hello @Darren_Bowers 

Like you mentioned for some cases you want to change the Click formula from "/t" to "/web".

 

You can find the domains and then tell the click formula to assign them different URLs and other URLs will remain the same.

 

Right now I am hard coding the domains but in the production, you may want to set the options to hold the list of domains.

 

Here the code.

 

var pattern = new RegExp("(YOUR_DOMAIN\.com|YOUR_DOMAIN2\.com)", 'i')
if( $(urlstring).match(pattern)) {

	//Click Formula HEre
	<% if( typeof strPurlTrackingServer!="undefined" && strPurlTrackingServer.toString() ) { %><%= strPurlTrackingServer %><% } else { %><%@ include option='NmsTracking_ServerUrl' %><% } %>/web/?id=<%=
	type.substr(0, 1) + (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 %><%
	} %>
}else{

		//Click Formula HEre
	<% if( typeof strPurlTrackingServer!="undefined" && strPurlTrackingServer.toString() ) { %><%= strPurlTrackingServer %><% } else { %><%@ include option='NmsTracking_ServerUrl' %><% } %>/web/?id=<%=
	type.substr(0, 1) + (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 %><%
	} %>

}

 

 

In the first link, we are adding the URLs where we want to change the domain. With the help of regex, we are filtering the domain and then adding the click formula with "/web" URL and for others, the URL will remain the same ie "/t".

 

With this change, you will have the new URLs with "/web" But they won't and will throw 404 error because the tracking server is not configured to accept the "/web" route. You will have to work with Adobe to add "/web" route to your tracking server and make it work.

 

Let me know if that helps.

 

Answers (1)

Answers (1)

Jyoti_Y

MVP

09-06-2020

Hi,

 

You can change your tracking URL in options:

1) Go to Administration > Platform > Options.

2) Search for 'NmsTracking_ClickFormula' and 'NmsTracking_OpenFormula'

3) Either create new trackingWebURL or Change the URL in these options according to your requirement. In your case, change highlighted 'r' with 'web'.

Jyoti_Y_0-1591768676217.png

 

4) In the delivery use the tracking URL which you have changed.

Thanks.