Freshpaint
Search
⌃K
Links

Google PubSub

Use the Google PubSub destination to send Freshpaint data to a Google Pub/Sub Topic, facilitating queued reliable delivery to any number of Topic subscribers.

Destination Info

Client-side
Server-side
Web
Mobile
Server

Getting Started

To set up the Google PubSub destination, follow the steps below:

Grant Freshpaint's Google Cloud Service Account publisher access to your Topic

  1. 1.
    In your Google Cloud Console, navigate to the Pub/Sub topic list​
  2. 2.
    Select one or more Topics using the checkboxes.
  3. 3.
    Click "Add Principal" and specify Freshpaint's Service Account email[email protected], then choose Role: "Pub/Sub" -> "Pub/Sub Publisher", then click "Save".
  4. 4.
    You should see the Freshpaint Service Account email listed under Role/Principal

Configure Freshpaint Event Definition to Topic Mappings

  1. 1.
    Go to the Google PubSub configuration page in Freshpaint and click "Configure" for Mappings.
  2. 2.
    Click "Add Mapping"
  3. 3.
    Enter the Event Definition name to be mapped
  4. 4.
    Enter the Google Pub/Sub Topic Name
  5. 5.
    Click "Save"

Events

When you send an event to the Google Pubsub destination from Freshpaint, Freshpaint will send Event data for each mapped Event Definition to the corresponding Topic. The body of the message will look like this:
{
"event": "a",
"type": "track",
"timestamp": "2022-12-28T21:16:50Z",
"messageId": "iI5pcrFfZHTuAfEu1DZ6Mg==",
"anonymousId": "1855a980cb1529-066ed15036156b-18525635-13c680-1855a980cb2178a",
"context": {
"page": {
"url": "https://example.com/",
"title": "Home Page",
"path": "/"
},
"library": {
"name": "freshpaint.js"
}
},
"properties": {
"customProp": 42
}
}I

Page

When a pageview event occurs, Freshpaint will send pageview event data to the corresponding Topic. The body of the message will look like this:
{
"type": "page",
"timestamp": "2022-12-28T21:51:30Z",
"messageId": "icgQY4taV/WsZPiE9/0ZaA==",
"anonymousId": "1855a980cb1529-066ed15036156b-18525635-13c680-1855a980cb2178a",
"context": {
"page": null,
"library": {
"name": "freshpaint.js"
}
},
"properties": {
"url": "https://example.com/",
"title": "Example Domain",
"path": "/"
}
}

Identify

When you call freshpaint.identify('[email protected]', {"phone": "+15558675309"}, Freshpaint will send Identify data for each mapped Event Definition to the corresponding Topic. The body of the message will look like this:
{
"type": "identify",
"timestamp": "2022-12-28T22:00:25Z",
"messageId": "Zi1TKug6D8lLqNUD1v0i1w==",
"anonymousId": "1855a980cb1529-066ed15036156b-18525635-13c680-1855a980cb2178a",
"userId": "[email protected]",
"context": {
"page": {
"url": "https://example.com/",
"title": "Home Page",
"path": "/"
},
"library": {
"name": "freshpaint.js"
}
},
"properties": {},
"traits": {
"phone": "+15558675309"
}
}

Group

When you call freshpaint.group("Acme, Inc", {"companyId": "1234"}),Freshpaint will send Group data for each mapped Event Definition to the corresponding Topic. The body of the message will look like this:
{
"type": "group",
"timestamp": "2022-12-28T21:56:23Z",
"messageId": "7Kx9d7JNjo3Tbi9IcFITYw==",
"anonymousId": "1855a980cb1529-066ed15036156b-18525635-13c680-1855a980cb2178a",
"context": {
"page": {
"url": "https://example.com/",
"title": "Home Page",
"path": "/"
},
"library": {
"name": "freshpaint.js"
}
},
"groupId": "Acme, Inc",
"properties": {},
"traits": {
"companyId": "1234"
}
}

Payload Format

Here is what each piece of message body means:
Key
Type
Description
event
string
The name of the event
type
string
The type of the event, for example "track", "identify", "page", or "group"
timestamp
string
The time the event occurred. Example: "2022-08-08T17:15:45Z"
messageId
string
Unique id identifying this event
anonymousId
string
The ID of the device the identify call was performed on
userId
optional string
An identifier that uniquely identifies the user that performed the event (usually email address)
groupId
optional string
For group events, a string that uniquely identifies the group this user belongs to (such as a company name).
context.page
object
Data about the page that the event was performed on
context.library
object
Data about the Freshpaint SDK that was used to capture this event
properties
object
Any additional event properties for Track and Page events
traits
object
Any additional properties of the user (for identify events) or group (for group events)

​