public static long getClientCustomerId ( AdWordsSession session ) { String accountIdStr = session . getClientCustomerId ( ) ; // clientCustomerId might be absent from AdWordsSession, e.g., for // ReportDefinitionService.getReportFields() and CustomerService.getCustomers(). // In this case, use ONE virtual account to handle rate limit of ALL unknown accounts combined. if ( accountIdStr == null ) { return VIRTUAL_CID ; } try { return Long . parseLong ( accountIdStr . replace ( "-" , "" ) ) ; } catch ( NumberFormatException e ) { throw new RateLimiterException ( "Encountered invalid CID: " + accountIdStr , e ) ; } }
Get client customer ID from the adwords session and convert it to Long type .