docs: private String insertHeader(Context context, JSONArray arr) {
          try {
              final JSONObject header = new JSONObject();
  
              String deviceId = getCleverTapID();
              if (deviceId != null && !deviceId.equals("")) {
                  header.put("g", deviceId);
              } else {
                  getConfigLogger().verbose(getAccountId(), "CRITICAL: Couldn't finalise on a device ID!");
              }
  
              header.put("type", "meta");
  
              JSONObject appFields = getAppLaunchedFields();
              header.put("af", appFields);
  
              long i = getI();
              if (i > 0) {
                  header.put("_i", i);
              }
  
              long j = getJ();
              if (j > 0) {
                  header.put("_j", j);
              }
  
              String accountId = getAccountId();
              String token = this.config.getAccountToken();
  
              if (accountId == null || token == null) {
                  getConfigLogger().debug(getAccountId(), "Account ID/token not found, unable to configure queue request");
                  return null;
              }
  
              header.put("id", accountId);
              header.put("tk", token);
              header.put("l_ts", getLastRequestTimestamp());
              header.put("f_ts", getFirstRequestTimestamp());
              header.put("ddnd",!(this.deviceInfo.getNotificationsEnabledForUser() && (getCachedGCMToken() != null || getCachedFCMToken() != null)));
              if(isBgPing){
                  header.put("bk",1);
                  isBgPing = false;
              }
              header.put("rtl", getRenderedTargetList());
  
  
              // Attach ARP
              try {
                  final JSONObject arp = getARP(context);
                  if (arp != null && arp.length() > 0) {
                      header.put("arp", arp);
                  }
              } catch (Throwable t) {
                  getConfigLogger().verbose(getAccountId(),"Failed to attach ARP", t);
              }
  
              JSONObject ref = new JSONObject();
              try {
  
                  String utmSource = getSource();
                  if (utmSource != null) {
                      ref.put("us", utmSource);
                  }
  
                  String utmMedium = getMedium();
                  if (utmMedium != null) {
                      ref.put("um", utmMedium);
                  }
  
                  String utmCampaign = getCampaign();
                  if (utmCampaign != null) {
                      ref.put("uc", utmCampaign);
                  }
  
                  if (ref.length() > 0) {
                      header.put("ref", ref);
                  }
  
              } catch (Throwable t) {
                  getConfigLogger().verbose(getAccountId(), "Failed to attach ref", t);
              }
  
              JSONObject wzrkParams = getWzrkParams();
              if (wzrkParams != null && wzrkParams.length() > 0) {
                  header.put("wzrk_ref", wzrkParams);
              }
  
              inAppFCManager.attachToHeader(context, header);
  
              // Resort to string concat for backward compatibility
              return "[" + header.toString() + ", " + arr.toString().substring(1);
          } catch (Throwable t) {
              getConfigLogger().verbose(getAccountId(), "CommsManager: Failed to attach header", t);
              return arr.toString();
          }
      }