Skip to main content
Once you have narrowed datosAProcesar to the records you want, you can export that working dataset in two ways: a machine-readable CSV file via exportarCSV() or a print-optimised browser view via imprimirPDF().
Apply your date range and any category or outlet filters before exporting. Both export methods operate exclusively on datosAProcesar — the currently filtered slice of data — so they always reflect whatever filters are active at the time you click.

CSV export

Click Export CSV to download estadisticas.csv. The file contains one header row followed by one data row per record in datosAProcesar.

Exported columns

Columns are written in the following fixed order:
#ColumnSource fieldDescription
1sendDateacf.sendDateOriginal broadcast date in dd/mm/YY format
2sendTimeacf.sendTimeBroadcast time
3mediaacf.mediaMedia outlet identifier
4programacf.programProgram identifier
5iaResumeacf.iaResumeAI-generated summary of the clipping
6linkacf.linkURL to the original source or recording
7topicsacf.topicsComma-separated category/topic tags

Delimiter and encoding

The file uses a semicolon (;) as the field delimiter and UTF-8 character encoding. Open it in Excel by choosing Data → From Text/CSV and setting the delimiter to semicolon, or import it directly into any tool that accepts delimited text.

How it works

exportarCSV()
exportarCSV() {
  const headers = ['sendDate', 'sendTime', 'media', 'program', 'iaResume', 'link', 'topics'];
  const csv = [
    headers.join(';'),
    ...this.datosAProcesar.map(row =>
      headers.map(header => row.acf[header]).join(';')
    )
  ].join('\n');

  const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
  const link = document.createElement('a');
  const url  = URL.createObjectURL(blob);

  link.setAttribute('href', url);
  link.setAttribute('download', 'estadisticas.csv');
  link.style.visibility = 'hidden';

  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
}
1

Build the CSV string

The method joins the header names with ; to form the first row, then maps each record in datosAProcesar to a ;-joined row of field values read from the record’s acf object.
2

Create a Blob

The full CSV string is wrapped in a Blob with MIME type text/csv;charset=utf-8;, keeping special characters intact.
3

Generate an object URL

URL.createObjectURL(blob) produces a temporary browser-managed URL pointing to the in-memory Blob.
4

Trigger a hidden link click

A hidden <a> element is appended to the document body with href set to the object URL and download set to estadisticas.csv. Programmatically clicking it triggers the browser’s native file-save dialog, then the element is removed from the DOM.
The media and program columns reflect the values as they appear in the WordPress ACF fields. The analytics component resolves abbreviations against the XLS media catalog on load, so if your catalog entries are current, the exported values will already contain full display names.

PDF print

Click Print to open the browser’s print dialog. imprimirPDF() calls window.print() directly:
imprimirPDF()
imprimirPDF() {
  window.print();
}
The browser renders the current page — including all visible charts — using whatever print stylesheet the application defines. From the print dialog you can save as PDF via your operating system’s built-in PDF printer.
Printing captures the entire rendered page, not just the filtered dataset. If the date or category filters change the visible charts, print immediately after filtering to ensure the PDF matches the data you intend to capture.

Best practices

  • Target your export. Apply date range, category (/c/:cat), and outlet (/m/:medio) filters before downloading. A well-scoped CSV is easier to share with officials than a full 30-day dump.
  • Verify the row count. The number of data rows in the CSV equals the number of records in datosAProcesar. Check the chart totals on screen to confirm the export covers what you expect.
  • Enrich with catalog names. Because media and program export as raw identifiers, join the CSV against the XLS media catalog in Excel or a reporting tool to get display names in your final deliverable.
  • Use print for quick briefings. The PDF path is fastest for one-off reports. For recurring analysis or data integration, prefer CSV.

Dashboard

Chart types and data loading overview.

Filtering

Date range, category, and outlet filters in detail.

Build docs developers (and LLMs) love