Send your event data from RudderStack to Google Pub/Sub.
5 minute read
Google Pub/Sub is an asynchronous messaging service that allows you to decouple the services that produce events from the services that process events. With Pub/Sub, you get durable message storage as well as a real-time message delivery system. The Google Pub/Sub servers run reliably with a consistent performance in all Google Cloud regions over the world.
RudderStack allows you to configure Google Pub/Sub as a destination and send your event data to it directly.
Find the open source transformer code for this destination in the GitHub repository.
Once you have confirmed that the platform supports sending events to Google Pub/Sub, perform the steps below:
From your RudderStack dashboard, add the source. From the list of destinations, select Google Pub/Sub.
Give a name to the destination and click Next. You should then see the following screen:
Google Pub/Sub Connection Settings
Enter the following details:
Connection Settings
Project ID and the Credentials: Follow these steps to obtain the project ID as well as the required credentials:
Create a service account from Google Cloud Console.
You can get the Project ID when you log in to your Google Cloud Console.
Use the Select a role dropdown to add the Pub/Sub Publisher role.
Create a key as JSON and download it.
Paste this downloaded JSON in the Credentials field
Enter the Event Name as well as the corresponding Topic ID. You can get the topic id from your topics page:
Google Pub/Sub Topic ID and Name
You can send an event type like page,identify,track.
For the track events you can specify the event name based on the event name in the payload.
For example:
If the event name is page it will send all calls with the type page.
If the event name is product added , it will send all track events with the event as product added.
If you want to send all events to a particular stream irrespective of the type or name, you can use * as the event name.
The topic ID is case-sensitive and has to be exactly as seen in Google Pub/Sub. On the other hand, the event name is case insensitive, and thus Page or page will both be considered as valid.
Finally, click Next to complete the configuration. Pub/Sub should now be added and enabled as a destination in RudderStack.
Attributes
You can send attributes to Google Pub/Sub along with the message. In order to send the attributes, enter the required attribute mapping in the RudderStack dashboard as seen below:
The following are some examples:
If the event is Product Viewed and the key is coupon, RudderStack will add the coupon key-value pair from the message to the attributes’ metadata object.
If multiple mappings are provided for Product Viewed, all such key-value pairs from the message body will be added to attributes’ metadata object.
If the event name is page it will send all calls with the type page.
For the key fields provided in the attributes map, the key is searched in the message body in root, properties, traits and context.traits - in that specific order.
Note: You can also specify the key path in the payload using the dot notation.
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.