# Google Cloud Functions

[Google Cloud Functions](https://cloud.google.com/functions) is a Functions-as-a-Service (FaaS) product that lets you run your code in the cloud without any servers or containers.

RudderStack supports Google Cloud Functions as a destination where you can send your event data seamlessly.

Find the open source code for this destination in the [GitHub repository](https://github.com/rudderlabs/rudder-transformer/tree/main/src/v0/destinations/google_cloud_function).

## Connection compatibility

{{< destination-config >}}

## Get started

Once you have confirmed that the source platform supports sending events to Google Cloud Functions, follow these steps:

1. From your [RudderStack dashboard](https://app.rudderstack.com/), add the source. Then, from the list of destinations, select **Google Cloud Functions**.
2. Assign a name to the destination and click **Continue**.

## Connection settings

To successfully set up Google Cloud Functions as a destination, you need to configure the following settings:

- **URL**: Enter the Trigger URL obtained in the **Trigger** field during the cloud function setup. For more information on obtaining the URL, see [FAQ]({{< ref "#how-do-i-create-a-google-cloud-function" >}}) below.
- **Required Authentication**: This setting is turned on by default. Turn it off if your cloud function does not require authentication.
- **Credentials**: Enter your service account credentials here. This is a required field if **Required Authentication** setting is turned on, that is, your cloud function requires authentication. To create service account credentials from scratch, see the [Google documentation](https://developers.google.com/workspace/guides/create-credentials#service-account).
- **Enable Batch Input**: Turn on this setting to pass a batch input (array of events) to your cloud function.
    - **Max Batch Size**: If **Enable Batch Input** setting is turned on, specify the maximum batch size in this field.
- **Consent management settings**: Configure the consent management settings for the specified source by choosing the **Consent management provider** from the dropdown and entering the relevant consent category IDs. See [Consent Management in RudderStack]({{< ref "data-governance/consent-management/overview.md" >}}) for more information on this feature.

## Supported events

Google Cloud Functions accepts [`identify`]({{< ref "event-spec/standard-events/identify.md" >}}), [`track`]({{< ref "event-spec/standard-events/track.md" >}}), [`page`]({{< ref "event-spec/standard-events/page.md" >}}), [`group`]({{< ref "event-spec/standard-events/group.md" >}}), and [`alias`]({{< ref "event-spec/standard-events/alias.md" >}}) events.

{{< info >}}
This destination accepts raw event data similar to a webhook. RudderStack sends the entire event payload to Google Cloud Functions without any transformation or modification. 
{{< /info >}}

## FAQ 

#### How do I create a Google Cloud Function?

1. Log in to your [Cloud Functions account](https://cloud.google.com/functions) and click **VIEW CONSOLE**.
2. Select your project.
3. Then, click **CREATE FUNCTION**.
4. Enter a **Function name** and select the **Region** from the dropdown.

{{< warning >}}
Verify that your cloud function name is valid.
{{< /warning >}}

5. In the **Trigger** field, select **HTTP** or **HTTPS**, depending on your use-case.
6. In the **Runtime, build and connections settings**, specify the memory allocated for the cloud function in the **Memory allocated** field.
7. Configure the rest of the cloud function settings as per your requirement and click **Next**.

{{< image src="images/event-stream-destinations/gcf-setup-1.webp" alt="Google Cloud Functions setup" >}}

8. Add the function code and the language in the **Runtime** field.
9. Enter the function name as defined in your code in the **Entry point** field.
10. Click **Deploy** to save your settings and create the Cloud Function.
11. In the **TRIGGER** tab, copy the trigger URL - this is required to set up Google Cloud Functions as a destination in RudderStack.

{{< image src="images/event-stream-destinations/gcf-url.webp" alt="Google Cloud Functions trigger URL" >}}
