Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The 4th edition of the Campaign Community Lens newsletter is out now!

Tracking URL option vars

Avatar

Level 1

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

7 Replies

Avatar

Community Advisor

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

Avatar

Level 1
but in my case i want to track only specific domains and want to drive it from an option variable instead of code . getoption does not seem to work either. Anyway to pass an option var here and read off it

Avatar

Level 3

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

Avatar

Level 1
i have used getoption in numerous other places , but it does not seem to work under the tracking code section

Avatar

Level 1
Error while compiling script 'content htmlContent' line 50: getOption is not defined. SCR-#ID# Javascript&colon; error while evaluating script 'content htmlContent'

Avatar

Level 3
@chez_elam Just tested this myself and you're right. The other format <%@ include option='Option_whitelistDomains' %> only allows you to add it to the URL string, rather than assign it to a variable. So the domains must have to be defined in the click formula.

Avatar

Administrator

Hi @chez_elam,

Were you able to resolve this query? Do let us know.

Thanks