PageSourceSearch

https://www.nylohotelnyc.com/js/utm-tracking.js

js nylohotelnyc.com collected 2026-10-08 10:57:48 UTC 4,126 bytes, 107 lines download raw bytes

1
2(function($){
3    // Give the URL parameters variable names
4    var u_source = getParameterByName('utm_source');
5    var u_medium = getParameterByName('utm_medium');
6    var u_campaign = getParameterByName('utm_campaign');
7    var u_term = getParameterByName('utm_term');
8    var u_content = getParameterByName('utm_content');
9
10    // Set the cookies
11    if(u_source != "" ) {
12        sessionStorage.utm_source = u_source;
13        //createCookie('utm_source', u_source);
14    }
15    if(u_medium != "") {
16        sessionStorage.utm_medium = u_medium;
17    }
18    if(u_campaign !="") {
19        sessionStorage.utm_campaign =  u_campaign;
20    }
21    if(u_term !="") {
22        sessionStorage.utm_term = u_term;
23    }
24    if(u_content !="") {
25        sessionStorage.utm_content =  u_content;
26    }
27
28    // pass utm params if anchor url is reztrip.com
29    $(document).on("click", "a", function(){
30        var source = sessionStorage.utm_source;
31        var medium = sessionStorage.utm_medium;
32        var campaign = sessionStorage.utm_campaign;
33        var term = sessionStorage.utm_term;
34        var content = sessionStorage.utm_content;
35        var currentUrl = window.location.origin;
36
37        var this_href = $(this).attr("href");
38
39        if(this_href.indexOf('?') != -1 )
40            this_href = this_href +"&";
41        else
42            this_href = this_href +"?";
43
44        if(source != null && source != '' && this_href.indexOf('utm_source') == -1){
45            this_href = this_href + 'utm_source='+source+'&';
46        }
47        if(medium != null && medium != '' && this_href.indexOf('utm_medium') == -1) {
48            this_href = this_href + 'utm_medium='+medium+'&';
49        }
50        if(campaign != null && campaign != '' && this_href.indexOf('utm_campaign') == -1){
51            this_href = this_href + 'utm_campaign='+campaign+'&';
52        }
53        if(term != null && term != '' && this_href.indexOf('utm_term') == -1){
54            this_href = this_href + 'utm_term='+term+'&';
55        }
56        if(content != null && content != '' && this_href.indexOf('utm_content') == -1){
57            this_href = this_href + 'utm_content='+content;
58        }
59
60        if(this.href.indexOf(currentUrl) == -1){
61           $(this).attr('href',this_href);
62        }
63
64
65
66    })
67    // pass utm params on form submission;
68    $(document).on('submit', 'form', function(){
69        var this_action = $(this).attr("action");
70        var source = sessionStorage.utm_source;
71        var medium = sessionStorage.utm_medium;
72        var campaign = sessionStorage.utm_campaign;
73        var term = sessionStorage.utm_term;
74        var content = sessionStorage.utm_content;
75        var utmEl='';
76
77        if(source != null && source != '' && $("input[name='utm_source']").length ==0 ){
78            utmEl = "<input type='hidden' name='utm_source' value='" + escape(source) + "'>";
79        }
80        if(medium != null && medium != '' && $("input[name='utm_medium']").length ==0) {
81            utmEl = utmEl + "<input type='hidden' name='utm_medium' value='" + escape(medium) + "'>";
82        }
83        if(campaign != null && campaign != '' && $("input[name='utm_campaign']").length ==0){
84            utmEl = utmEl + "<input type='hidden' name='utm_campaign' value='" + escape(campaign) + "'>";
85        }
86        if(term != null && term != '' && $("input[name='utm_term']").length ==0){
87            utmEl = utmEl + "<input type='hidden' name='utm_term' value='" + escape(term) + "'>";
88        }
89        if(content != null && content != '' && $("input[name='utm_content']").length ==0){
90            utmEl = utmEl + "<input type='hidden' name='utm_content' value='" + escape(content) + "'>";
91        }
92        if(utmEl != '' ){
93            utmEl = $(utmEl);
94            $(this).prepend(utmEl);
95        }
96    });
97
98    // Parse the URL
99    function getParameterByName(name) {
100        name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
101        var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
102            results = regex.exec(location.search);
103        return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
104    }
105
106
107})($);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.