-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCaptureURLandUTMcodes.js
25 lines (23 loc) · 1.1 KB
/
CaptureURLandUTMcodes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
jQuery(document).ready(function() {
setTimeout(function() {
var parentFrame = window.location;
var desiredControl = loader.getEngine().getDocument().getControlsList().find(function(control) {
return control.id === 2912198; // the desired control id
});
desiredControl.setValue({value: parentFrame.href});
console.log('custom static resource loaded');
}, 2000);
function getReferrer() {
setTimeout(function() {
var queryString = window.location.search;
var urlParams = new URLSearchParams(queryString);
var utmSource = urlParams.get('utm_campaign');
var utmMedium = urlParams.get('utm_source');
var utmCampaign = urlParams.get('utm_medium');
loader.engine.document.getElementById(2925815).setValue({ value: utmSource });
loader.engine.document.getElementById(2925816).setValue({ value: utmMedium });
loader.engine.document.getElementById(2925814).setValue({ value: utmCampaign });
}, 1000);
}
window.onclick = getReferrer;
});