src/universal-analytics.c
unsigned int assembleQueryString(UATracker_t* tracker, char* query, unsigned int offset){
  unsigned int i;
  char* name;
  char* value;
  int name_len;
  unsigned int value_len;

  // Shortcut for client_id for more readable assertion below
  char* client_id = tracker->map_parameters[UA_CLIENT_ID];


  for(i = 0; i < UA_MAX_PARAMETERS; i++){
    
    getCurrentParameterValue(tracker, i, & name, & value);

    // Validate parameters given
    assert((name == client_id) ? (value != NULL) : 1);
    if(NULL == name || NULL == value)  continue;

    name_len = strlen(name);
    value_len = strlen(value);

    if(i > 0){
      strncpy(query + offset, "&", 1);
      offset++;
    }

    strncpy(query + offset, name, name_len);
    strncpy(query + offset + name_len, "=", 1);

    /* Fill in the encoded values */
    value_len = encodeURIComponent(value, (query + offset + name_len + 1), value_len, 0);
    
    offset += (name_len + value_len + 1);
  }
  return offset; 
}
/* Construct a query-string based on tracker state */
Construct a query-string based on tracker state
Construct a query - string based on tracker state
unsigned int assembleQueryString(UATracker_t* tracker, char* query, unsigned int offset){
  unsigned int i;
  char* name;
  char* value;
  int name_len;
  unsigned int value_len;
  char* client_id = tracker->map_parameters[UA_CLIENT_ID];
  for(i = 0; i < UA_MAX_PARAMETERS; i++){
    getCurrentParameterValue(tracker, i, & name, & value);
    assert((name == client_id) ? (value != NULL) : 1);
    if(NULL == name || NULL == value)  continue;
    name_len = strlen(name);
    value_len = strlen(value);
    if(i > 0){
      strncpy(query + offset, "&", 1);
      offset++;
    }
    strncpy(query + offset, name, name_len);
    strncpy(query + offset + name_len, "=", 1);
    value_len = encodeURIComponent(value, (query + offset + name_len + 1), value_len, 0);
    offset += (name_len + value_len + 1);
  }
  return offset; 
}
unsigned int assembleQueryString ( UATracker_t * tracker , char * query , unsigned int offset ) { unsigned int i ; char * name ; char * value ; int name_len ; unsigned int value_len ; char * client_id = tracker -> map_parameters [ UA_CLIENT_ID ] ; for ( i = 0 ; i < UA_MAX_PARAMETERS ; i ++ ) { getCurrentParameterValue ( tracker , i , & name , & value ) ; assert ( ( name == client_id ) ? ( value != NULL ) : 1 ) ; if ( NULL == name || NULL == value ) continue ; name_len = strlen ( name ) ; value_len = strlen ( value ) ; if ( i > 0 ) { strncpy ( query + offset , " " , 1 ) ; offset ++ ; } strncpy ( query + offset , name , name_len ) ; strncpy ( query + offset + name_len , " " , 1 ) ; value_len = encodeURIComponent ( value , ( query + offset + name_len + 1 ) , value_len , 0 ) ; offset += ( name_len + value_len + 1 ) ; } return offset ; }
Construct a query-string based on tracker state
Construct a query - string based on tracker state
// Shortcut for client_id for more readable assertion below // Validate parameters given /* Fill in the encoded values */