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

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. In your Google Cloud Console, navigate to the Pub/Sub topic list

  2. Select one or more Topics using the checkboxes.

  3. Click "Add Principal" and specify Freshpaint's Service Account emailpubsub@freshpaint-1.iam.gserviceaccount.com, then choose Role: "Pub/Sub" -> "Pub/Sub Publisher", then click "Save".

  4. You should see the Freshpaint Service Account email listed under Role/Principal

Configure Freshpaint Event Definition to Topic Mappings

  1. Go to the Google PubSub configuration page in Freshpaint and click "Configure" for Mappings.

  2. Click "Add Mapping"

  3. Enter the Event Definition name to be mapped

  4. Enter the Google Pub/Sub Topic Name

  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('hello@example.com', {"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": "hello@example.com",
    "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:

Last updated