Skip to main content

Create Google Spreadsheet: Google Analytics 4

In order to import your tracking data from Google Analytics 4, it must first be transferred to a Google Spreadsheet. You can then link this to Channel Pilot Pro.

Activate Google Spreadsheet extension

There is an extension for Google Spreadsheets to import data from Google Analytics 4.

  1. Log in to your Google account where you use Google Analytics 4.

  2. Open an empty Google Spreadsheet.

  3. Now call up the Google Analytics extension via "Extensions -> Add-ons -> Call up add-ons".

  4. Search there for the extension “GA4 Magic Reports” and install it.

Configure Google Analytics 4 report

Now a report must be configured in Google Spreadsheets using the installed extension.

  1. Click on "Extensions -> GA4 Magic Reports -> Create new report"

  2. The following settings must be made in the “Create new report” window:

    1. Name: Enter the name for your report

    2. Select a view: Select your Google Account and your property for which you want to create the report.

    3. Date Range:

      1. Start Date: select today's date

      2. End Date: select today's date

    4. Metrics: Select the following:

      1. Sessions

      2. Items purchased

      3. Item revenue

    5. Dimensions: Select the following:

      • Session campaign

      • Item ID

  3. Click on Create Report.

  4. Enter 3daysAgo” as the start and end date in the report configuration.

    Your configuration should now look like this:

  5. Create the report by going to "Extensions -> GA4 Magic Reports -> Run reports".

  6. To create the daily report, you can set a regular update under "Extensions -> GA4 Magic Reports -> Schedule reports".

Editing the report in the Google Spreadsheet

Your report should look like this:

The created report still needs to be edited so that it can be imported into Channel Pilot Pro. The following changes must be made:

  • First, the header rows of the report, up to the header columns of the latest report, must be removed.

  • In addition, a column with a date is required. You can add this at the beginning or at the end, for example.

    • This should contain the following formula so that it contains yesterday's date.

=IF(B2="";"";TO:DATE(TODAY()-1))

Finally, the format of the date column must be changed to the following format:

yyyy-mm-dd

You can also use the following macro. This contains the changes listed above:

/** @OnlyCurrentDoc */

function bearbeiten() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('1:14').activate();
spreadsheet.getActiveSheet().deleteRows(spreadsheet.getActiveRange().getRow(), spreadsheet.getActiveRange().getNumRows());
spreadsheet.getRange('A:A').activate();
spreadsheet.getActiveSheet().insertColumsBefore(ActiveRange().getColumn(), 1);
spreadsheet.getActiveRange().offset(0, 0, spreadsheet.getActiveRange().getNumRows(), 1).activate();
spreadsheet.getRange('A1').activate();
spreadsheet.getCurrentCell().setValue('Date');
spreadsheet.getRange('A2').activate();
spreadsheet.getCurrentCell().setValue('=IF(B2="";"";TO_DATE(TODAY()-1))');
spreadsheet.getRange('A3:A3000').activate();
spreadsheet.getRange('A2').copyTo(spreadsheet.getActieRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
spreadsheet.getRange('A:A').activate();
spreadsheet.getActiveRangeList().setNumberFormat('yyyy"-"mm"-"dd');
};

The final report should look like this:

Macro to automate the import

A macro for customizing the report helps you to automate the complete tracking data.

You can then run this macro automatically after your report has been updated. To do this, carry out these steps in the Google Spreadsheet with the report:

  1. Go to Extensions -> Macros -> Manage Macros

  2. Click on "Edit script" to the right of your macro.

  3. Select Trigger (clock symbol) in the left menu and then "Add trigger".

  4. Time-controlled” should be selected for the date source and the execution should be started after the report has been created.

The report is now ready and can be imported.

A regular import can now also be created in Channel Pilot Pro, which is always started after the report has been generated, and the macro has been executed.

Did this answer your question?