Google Analytics Custom Variable Code Fix

Hello All--

Our goal is twofold...

1. Scan a page for an area of text "ID" and then submit then place the number after said ID into a variable.

2. Pass the variable to Google Analytics.

The code we have is not working... it never finds the ID.

The script will be used on several pages, but the text to search for is always that same... that is:

ID: ## up to ID: #####

So the ID can be from 2 to 5 digits.

I'm attaching screenshots that visually display the example above.

The project shouldn't take more than an hour for the right coder. The broken/erroneous code is below:

(placed at the top of page)

<script type="text/javascript">

//Define a trim function to trim the white spaces both before and end of string

[url removed, login to view] = function () {

return [url removed, login to view](/^\s*/, "").replace(/\s*$/, "");}

//Search Function to get the ID

function GetID(){

var spans = $("span");

var i = 0;

//Define the regix object that checks the presence of both Applicant: and ID: in the string

var re = /Applicant:.+ID:.+/;

for(i = 0; i < [url removed, login to view]; ++i)

{ if( spans[i].[url removed, login to view](re))


return spans[i].[url removed, login to view]("ID:")[1].trim();



return "NOT FOUND";



(placed at bottom of page)

<script type="text/javascript">

var gaJsHost = (("https:" == [url removed, login to view]) ? "https://ssl." : "http://www.");

[url removed, login to view](unescape("%3Cscript src='" + gaJsHost + "[url removed, login to view]' type='text/javascript'%3E%3C/script%3E"));


<script type="text/javascript">

leadID = GetID();

try {

var pageTracker = _gat._getTracker("UA-1XXXXXX-1");






} catch(err) {}</script>

Beceriler: Google Analytics, Javascript

Daha fazlasını gör: fix google custom var, up string, text string search, submit prototype, string match, place code, our code, m string, match string, id to code, id analytics, hour of code, google js, get right code, get location javascript, get length of string in c, err com, define coder, code top, code search, code get, javascript analytics custom, get code, custom write, type code

İşveren Hakkında:
( 33 değerlendirme ) Raleigh, United States

Proje NO: #694825



I can update your script to parse ID and it to Google Analytics.

1 gün içinde %selectedBids___i_sum_sub_4%%project_currencyDetails_sign_sub_5% USD
(188 Değerlendirme)