InPost Pay - Analytics

InPost Pay - Analytics

Initial requirements

Initial requirements – direct integration

In the case of direct integration, the data presented below must be passed in accordance with the API documentation available at the following address:

For the purposes of analytics, it is necessary to pass the following parameters in the order_additional_parameters structure:

"order_additional_parameters": [ { "key": "client_id", "value": "..." }, { "key": "fbclid", "value": "..." }, { "key": "gclid", "value": "..." } ]

These parameters must be delivered via the frontend and assigned to the user placing an order.

Additional Requirements — client_id for Adding and Updating the Cart

For direct integration, it is required that the client_id from the Google Analytics 4 cookie is also sent when:

  • Adding a product to the cart,

  • Updating the cart (e.g., changing the quantity, removal).

  • This data should be transmitted to the InPost Pay API as part of the order_additional_parameters:

"order_additional_parameters": [ { "key": "client_id", "value": "GA1.2.1234567890.1234567890" } ]

Recommended source: reading the client_id from the _ga cookie or using gtag('get', ..., 'client_id', callback) on the frontend side.

Failure to pass the client_id at this stage may prevent proper session and conversion attribution in GA4 analytics and Google Ads.


GA4

Configuration of GA4-InPost Pay integration

The instructions below provide a step-by-step guide on how to configure a purchase event upload to Google Analytics 4 (GA4) using a backend integration based on Google Cloud Functions.

Step 1: Export data from Google Analytics 4

  1. Go to the Admin tab on the GA4 panel

    image-20250606-105936.png
  2. Select Admin > Data collection and modification > Data streams

    image-20250606-110124.png
  3. Select the data stream to which you want to upload purchase events

    image-20250606-110209.png
  4. Copy and save Measurement ID from the stream window.

    You will need it later. Then select Measurement Protocol API Secrets.

    image-20250606-110326.png

     

  5. Click the Create button

    image-20250606-110615.png
  6. Enter name and click Create

    image-20250606-110644.png
  7. Copy and save Secret value – it will be necessary during function implementation

    image-20250606-110713.png

     

Step 2: Obtain access data to the InPost Pay API
In order to connect to the InPost Pay API and export purchase data, you will need two values:

Step 3: Implement integration in Google Cloud
Requirements:

  • Google Coud (GCP) account with billing enabled

  • gcloud (Google Cloud SDK) tool installed

  • Basic terminal (cmd / bash) knowledge

  • Python 3.11 (locally)

  • Folder with 3 files:

    • main.py

    • requirements.txt

    • deploy.sh

You can download and unzip the file manually via a browser

 

  1. Launch the terminal and navigate to the folder containing the files
    Example:

    cd ~/Pobrane/cloud-function-ga4
  2. Grant permissions to run the deployment script

    chmod +x deploy.sh
  3. Run the deployment script

    ./deploy.sh
  4. Script will ask you to enter input data:

    1. Your project ID in Google Cloud (e.g. my-eu-project-123)

    2. Region (you can press Enter – by default: europe-central2)

    3. client_id and client_secret from InPost Pay

    4. Measurement ID and API Secret from GA4

  • The script will:

  • set a GCP project

  • create secrets using the provided data

  • assign appropriate privileges to functions

  • implement the HTTP function (Cloud Function Gen2)

  • set a schedule to automatically call the function every 30 minutes

  1. Check function
    Once deployment is completed, the following message will be displayed in the terminal:

Function has been deployed and run schedule has been set.

You can also go to Google Cloud Console → Cloud Run functions → check inpost-ga4-integration function status.

  1. What next?
    Now, every 30 minutes, the function will independently:

  • connect to the InPost Pay API

  • collect purchase data

  • send them as purchase events to GA4

If you want, you can manually run the function via GCP to test how it functions.

How to download deployment files?

You can download the files from InPost Pay documentation.

  1. Click below and download cloud-function-ga4.zip

  1. Send the file to the server, to the cloud or unzip it locally.

 


 

Google Ads

Configuring the import of conversions from GA4 to Google Ads

To track conversions originating from GA4 integration and use them in Google Ads (e.g. to optimize campaigns), you need to link accounts and import purchase events as conversions.

You will find a step-by-step instruction on how to do that below.

Step 1: Connect Google Analytics 4 with Google Ads

  1. Log in to the Google Analytics 4 account.

  1. Go to the Administrator (Admin) tab.

  1. In the Property column, click Google Ads Links.

  1. Click + to add a new link.

  1. Select the Google Ads account you want to link.

  1. Confirm and finish configuration.
    The linked Google Ads account will be able to collect data on conversions from GA4.


Step 2: Configure the import of conversions in Google Ads

  1. Log in to the linked Google Ads account.

  1. Go to Tools and Settings > Measurement > Conversions.

  1. Click New conversion > Import.

  1. Select Google Analytics 4: events.

  1. Select the linked GA4 service.

  1. Select events to be imported, e.g. purchase.

  1. Click Import and continue.
    Once the events are imported, they will be visible in the Google Ads panel as a source of GA4 conversions.


Step 3: Make sure that conversion are reported

  1. Go to the Google Ads > Conversions panel.

  1. Check whether the selected events have the “Receiving Data” status.

  1. Data should start to appear after several hours, if the GA4 integration is functioning correctly.


Comments
GA4 no longer supports session-based conversion – a conversion is assigned to the user based on the attribution model selected in Google Ads.
Purchase events must contain transaction_id – this ensures correct deduplication.


Sources and Google documentation: