Tracking URL option vars

chez_elam

24-08-2020

Hi , I am trying to see if I can only filter out certain domains to be tracked in the tracking code. Trying to assign an option variable to a variable and not able to do that .

something like

var pattern = new RegExp(%><%@ include option='Option_whitelistDomains' %><%, 'i');

 

Is this even possible.

 

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

taplondon_josh

25-08-2020

Hi @chez_elam,

You should be able to bring the Option values into a variable like this:

var optVal = getOption('Option_whitelistDomains');

var whitelistDomains = optVal.split(",");

Then create a new reg exp for each domain in the whitelistDomains array and check for a match before applying the tracking parameters.

Thanks,

Josh

DavidKangni

MVP

24-08-2020

Hi,

 

I did something like that to avoid appending tracking code to social network links in emails. Basically i'm not tracking facebook , twitter youtube, etc..

 

<% if( typeof strPurlTrackingServer!="undefined" && strPurlTrackingServer.toString() ) { %><%= strPurlTrackingServer %><% } else { %><%@ include option='NmsTracking_ServerUrl' %><% } %>/r/?id=<%=
type.substr(0, 1) + (message.id<0 ? (message.id+4294967296) : message.id).toString(16).toLowerCase()
%>,<%@ value object="delivery" xpath="@idTracking" %>,<%= escapeUrl("$(urlId)") %>
<% if( $(urlstring).match(/http(s)*:\/\/[a-zA-Z0-9]*\.facebook\.com|flickr\.com|twitter\.com|foursquare\.com|pinterest\.com|plus\.google\.com|youtube\.com|instagram.com/) )
{ } else {%>&utm_source=Neolane&utm_medium=email&utm_campaign=<%= delivery.label %>&utm_term=<%= formatDate(new Date(), "%4Y%2M%2D") %><% } %>
<%
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 %><%
} %>

 

Hope it helps

Thanks,

David