Expand my Community achievements bar.

SOLVED

Modify Tracking URL

Avatar

Level 9

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!

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

 


     Manoj
     Find me on LinkedIn

View solution in original post

6 Replies

Avatar

Community Advisor

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.

Avatar

Level 9
Thanks @Jyoti_Yadav - I have done this but when I click the new tracking link I get a 404 error as it doesnt recognise the new tracking path. Do you know what I have to update for the server to receive clicks from the new tracking path?

Avatar

Community Advisor
Hi Darren, Is new tracking path configured? You need to raise a request to Adobe to add this new tracking URL path in serverConf.xml <redirection> xml element.

Avatar

Level 9
I'm going to try Adobe support again and see if they will add this extra tracking route for us. Cheers!

Avatar

Correct answer by
Community Advisor

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.

 


     Manoj
     Find me on LinkedIn

Avatar

Level 9
Hey @_Manoj_Kumar_ this is really detailed and helpful - thanks! I am hoping that Adobe will modify the tracking servers as we are using a hosted model. Thanks again