tags:

views:

60

answers:

3

I am trying to debug this piece of code:

  $(document).track(
{
 'module' : 'Omniture',
 'event' : 'instant',
 'args' :
  {
   'linkTrackVars' : 'products,events,eVar31,eVar32,eVar33,eVar34,eVar35,eVar36,eVar37',
   'linkTrackEvents' : '',
   'linkType' : 'o',
   'linkName' : 'Click'
    'svalues' : {
    'products' : ';OFFERID1[,;OFFERID2]',  
    'events'   : 'Add',  
    'eVar31' : id,
    'eVar32' : family,
    'eVar33' : c_id,
    'eVar34' : r_id,
    'eVar35' : inetwork,
    'eVar36' : customer, 
    'eVar37' : tag
   },
  },
 'defer' : '0';
},
);

I am getting following error messages:

   missing } after property list
 'svalues' : {\n

Any clue.

+1  A: 

Your last line (within the object) shouldn't end in a semicolon:

'defer' : '0'

Plus, IE will throw an error if the last item in a set ends in a comma. Corrected code below:

$(document).track(
{
 'module' : 'Omniture',
 'event' : 'instant',
 'args' :
  {
   'linkTrackVars' : 'products,events,eVar31,eVar32,eVar33,eVar34,eVar35,eVar36,eVar37',
   'linkTrackEvents' : '',
   'linkType' : 'o',
   'linkName' : 'Click',
    'svalues' : {
    'products' : ';OFFERID1[,;OFFERID2]',  
    'events'   : 'scAdd',  // Cart event
    'eVar31' : id,
    'eVar32' : family,
    'eVar33' : id,
    'eVar34' : _id,
    'eVar35' : _network, 
    'eVar36' : customer, 
    'eVar37' : page_tag
   }
  }
 'defer' : '0'
}
);
adam
Yes it does....
Rachel
Yes it does what?
adam
It does not solve the problem and am getting same error message.
Rachel
Maybe run it through a JSON validator? http://www.jsonlint.com/
adam
How can this be done.jsonlint.com
Rachel
+1  A: 

You're missing a comma here:

'linkName' : 'Click',
shinkou
A: 

you can try this:

 $(document).track(
  {
 'module' : 'Omniture',
 'event' : 'instant',
 'args' :
  {
  'linkTrackVars' : 'products,events,eVar31,eVar32,eVar33,eVar34,eVar35,eVar36,eVar37',
  'linkTrackEvents' : '',
  'linkType' : 'o',
  'linkName' : 'Click',
  'svalues' : {
  'products' : ';OFFERID1[,;OFFERID2]', 
  'events'   : 'scAdd',  // Cart event
  'eVar31' : _id,
  'eVar32' : family,
  'eVar33' : id,
  'eVar34' : t_id,
  'eVar35' : network, 
  'eVar36' : customer, 
  'eVar37' : page_tag
  },
},
'defer' : '0'
});
andreas
was this helpful?
andreas
It still gives me the same error message ?
Rachel
try the edited version...i gave it a try locally..no errors.
andreas