PageSourceSearch

https://www.csmediagroup.com/wp-content/plugins/zoho-crm-forms/assets/js/zcga.js?ver=1.8.2.3

js csmediagroup.com collected 2026-10-04 12:54:04 UTC 4,180 bytes, 176 lines download raw bytes

1//$Id$
2function getValue(p_n, ix)
3{
4	var q_s = '';
5	if  (p_n == 'q')
6	{
7		var ref = document.referrer;
8		if (ref != undefined) {
9		q_s= ref.split('?')[1];
10		}
11	}
12	else
13	{
14		try
15		{
16            q_s = window.top.location.search.substring(1);
17		}
18		catch(e)
19	    {
20			q_s = '';
21	    }
22	}
23	var pa_n = p_n +'='; 
24	var p_v = '';
25	if(q_s!=undefined && q_s.length > 0 ){
26		begin = q_s.indexOf ( pa_n );
27		if ( begin != -1 )
28		{
29			begin += pa_n.length;end = q_s.indexOf ( '&' , begin );
30			if ( end == -1 )
31			{
32				end = q_s.length
33			}
34			p_v = q_s.substring ( begin, end );
35		}
36	}
37	if (p_v == undefined || p_v=='')
38	{
39		p_v=g_c(GAd.indexValueArr[ix]);
40	}
41	if (p_v!=undefined)
42	{
43		p_v = p_v.replace(/\+/g,' ');
44	}
45	return p_v;
46}
47
48
49GAd.prop=GAd.prop || [];
50GAd.indexValueArr=new Array('gclid');
51function GAd(){
52
53}
54GAd.prototype.initialize=function()
55{
56	GAd.prop.push([GAd.indexValueArr[0],getValue(GAd.indexValueArr[0],0)]);
57	//GAd.prop.push([GAd.indexValueArr[1],getValue(GAd.indexValueArr[1],1)]);
58	//GAd.prop.push([GAd.indexValueArr[2],getValue(GAd.indexValueArr[2],2)]);
59	
60	for (var i=0;i<GAd.prop.length;i++)
61	{
62		this.s_c(i);	
63	}
64	this.s_Hid();
65	
66}
67GAd.prototype.s_Hid=function()
68{
69	var is_set = false;
70	var all_Frm = document.forms;
71    	for( var i = 0; i < all_Frm.length; i++ ) 
72	{
73		var frm = all_Frm[i];
74			for (var ii=0;ii<frm.length;ii++)
75			{
76				if( frm.elements[ii].name == 'zc_gad' ) {
77					
78					var p = g_c(GAd.indexValueArr[0]);
79					var hidEl = document.getElementsByName('zc_gad');
80					if (hidEl)
81					{
82						for (var idx =0 ; idx < hidEl.length; idx++ )
83					{
84						hidEl[idx].value = p;  
85						is_set = true;
86					}
87				}
88
89			}
90		}
91	}
92	
93	// if the value of google click id is not set in the hidden element. 
94	// there are possible reasons,
95	// 1) Page might not have the form kind of implementation (or)
96	// 2) Hidden element name might be different from third party form and not being editable.
97	if (all_Frm && all_Frm.length == 0) {
98		// web page might not have the form kind of implementation
99		var hidEl = document.getElementsByName('zc_gad');
100		if (hidEl && hidEl.length > 0) {
101			var p = g_c(GAd.indexValueArr[0]);
102			for (var idx = 0; idx < hidEl.length ; idx++) {
103				hidEl[idx].value = p;
104				is_set = true;
105			}
106		}
107		
108	}
109	
110	if (!is_set) {
111		// <script type="text/javascript" src='<protocol>://crm.zoho.com/crm/javascript/zcga.js' name='zcga' id='zcga' zcga_element_name="<replace_tp_webform_name>"></script> 
112		// Hidden element name might be different from third party form and not being editable.
113		var zcga_script_elem = document.getElementsByName("zcga");
114		if (zcga_script_elem && zcga_script_elem.length == 1) {
115			var zcga_hidEl_name = zcga_script_elem[0].getAttribute('zcga_element_name');
116			if (zcga_hidEl_name) {
117				var hidEl = document.getElementsByName(zcga_hidEl_name);
118				if (hidEl && hidEl.length > 0) {
119					var p = g_c(GAd.indexValueArr[0]);
120					for (var idx = 0; idx < hidEl.length ; idx++) {
121						hidEl[idx].value = p;
122						is_set = true;
123					}
124				}
125			}
126		}
127	}
128}
129GAd.prototype.s_c=function(index,path,domain,secure)
130{
131	value = GAd.prop[index];
132	var c_str = GAd.indexValueArr[index] + "=" + escape ( value[1] );
133	var exp_d=30;
134	var exdate=new Date();
135	exdate.setDate(exdate.getDate()+exp_d);
136	c_str += "; expires=" + exdate.toGMTString();//No I18N
137	
138	//if ( path )
139	c_str += "; path=/";//No I18N
140	if ( domain )
141	c_str += "; domain=" + escape ( domain );//No I18N
142	if ( secure )
143	c_str += "; secure";//No I18N
144	document.cookie = c_str;
145}
146new GAd().initialize();
147
148function g_c(c_name)
149{
150        var cArr = document.cookie.split('; ');
151        var cArrLen = cArr.length;
152        for (var i = 0; i < cArrLen ; i++) {
153                var cVals = cArr[i].split('=');
154		if (cVals[0] === c_name && cVals[1]){
155			return unescape(cVals[1]);
156		}
157        }
158}
159
160/* Iframe support goes here */
161function IFrameSupport()
162{
163	var frm;
164	frm = document.getElementsByTagName("iframe");
165	for (var i = 0; i < frm.length; ++i)
166	{
167		if ( (frm[i].src).indexOf('WebFormServeServlet') > 0 )
168		{
169			var gclid = g_c(GAd.indexValueArr[0]);
170			var src = frm[i].src;
171			src = src+"&gclid="+gclid;//No I18N
172			frm[i].src = src;
173		}	
174	}
175}
176IFrameSupport();

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.