# Activate events in Google Analytics ## Learn how to send events in real time to Google Analytics. ## Before you begin Before proceeding, make sure you have already configured at least one [event source](https://www.krenalis.com/docs/collect-events.md) in Krenalis. Google Analytics activation requires an existing source, since events must originate from a connected source before they can be routed to this destination. ## Steps ### 1. Create a Measurement ID and API secret To start, you need to create an API secret in your Google Analytics property. 1. Log in to your Google Analytics account. 2. Click **Admin** (bottom left of the page) → **Data streams** and select the stream where you want to send events. 3. In the stream details, copy the **Measurement ID** — you'll need it later. 4. Scroll down to **Measurement Protocol API secrets** and click **Create**. 5. Enter a name for the secret, for example “Krenalis destination,” then click **Create**. 6. Copy the **Secret value** shown next to the new key. ### 2. Connect Krenalis with Google Analytics Continue by connecting Krenalis to your Google Analytics account. 1. In your Krenalis workspace, open the **Destinations** page. 2. Click **Add a new destination ⊕**, then select the **Google Analytics** card. 3. Click **Add destination...**. 4. (Optional) In **Name**, enter a label to identify the connection later. 5. Fill in the following fields and click **Add**: | Field | Description | |--------------------------|----------------------------------------------------------------------------------------------------------------| | Measurement ID | Measurement ID of your GA4 data stream (starts with "G-"). You copied this in Step 1. | | API Secret | API secret for the Measurement Protocol of your GA4 data stream. You generated and copied this in Step 1. | | Collection Endpoint | Choose the endpoint you want to use for sending events, according to your data governance or privacy policies. | ### 3. Link an event source Events received from an event source are delivered to Google Analytics in real time. Click **Link event source…** and select one or more sources to define where events should originate from. [Link event source](https://www.krenalis.com/docs/activate-events/images/link-event-source.png)! If no event sources are available, you can continue with the setup and link a source later. Keep in mind that event delivery cannot be tested until at least one source is connected. ### 4. Define a pipeline for each event Krenalis supports all [Measurement Protocol events](https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference/events), letting you define a dedicated pipeline for each event you send to Google Analytics. Select an event from the list and click **Add pipeline…** to link it with Google Analytics. To define additional events, click **Add new pipeline ⊕** and pick the event from the list. Repeat this step to add additional events. [Add pipeline](https://www.krenalis.com/docs/activate-events/images/add-google-analytics-pipeline.png)! ### 5. Set event conditions Based on the event selected in the previous step, set a filter that defines the conditions the incoming event must meet. Use filters to control exactly when an event should be sent to Google Analytics—for example, only when specific properties or pipelines occur in Krenalis. [Filter events](https://www.krenalis.com/docs/activate-events/images/filter-google-analytics.png)! For example, the previous filter can be used to send an "Add To Cart" event. In this case, Krenalis sends the event only when both conditions are true: the event type is **track** and the event name is **Product Added**. This prevents unnecessary or duplicate data from being sent to Google Analytics. ### 6. Set event parameters Next, define how the event data is sent to Google Analytics by mapping your event fields to the parameters expected by the Measurement Protocol. Each parameter you configure determines how Krenalis translates and delivers the event payload to Google Analytics. [Event parameters](https://www.krenalis.com/docs/activate-events/images/transform-google-analytics.png)! For example, you can map the properties of the incoming event to standard GA4 parameters such as **currency**, **value**, or **items**. In the example shown, the field `properties.amount` is mapped to the **value** parameter, `properties.products` to **items**, and the string `"USD"` to **currency**. This ensures that the "Add To Cart" event contains all the required details when sent to Google Analytics. ### 7. Save your changes When you're done, click **Add** (or **Save** if you're editing an existing pipeline). The new pipeline will appear in the Google Analytics connection page. To send additional events to Google Analytics, repeat the process starting with the [Define a pipeline for each event](#4-define-a-pipeline-for-each-event) step. ## Pipelines Once saved, the new pipeline appears in the pipelines list for Google Analytics. From here, you can monitor deliveries, adjust filters, and event parameters. Each pipeline defines how and when events flow from sources to Google Analytics. With a single Google Analytics connection, you can create multiple event pipelines, each dedicated to a specific event type you want to send. [Pipeline to export user data](https://www.krenalis.com/docs/activate-events/images/pipelines.google-analytics.png)! | Column | Description | |--------------|---------------------------------------------------------------------------------------| | **Pipeline** | Name and description of the pipeline. | | **Filters** | Conditions used to select which events are sent. If not set, all events are included. | | **Enable** | Switch to activate or deactivate the pipeline. When disabled, no events are sent. | | **Manage** | Edit settings such as filter and transformation. | | **⋮ (More)** | Additional options, such as deleting the pipeline. |