Post viewed

Record when a user views a blog post.

This event tracks when a user views a blog post.

Croct's mascot neutral
When should I track this event?

Track this event whenever a user views a blog post or similar form of content.

Implementation

Here is an example of how to track this event:

example.js
123456789
import croct from '@croct/plug';
croct.track('linkOpened', {
post: {
postId: 'croct-launches-new-sdk',
title: 'Croct launches new SDK',
publishTime: 1499839200000
}
});

Input properties

These are the supported properties:

post
object

The information about the blog post.

postId
string

The unique identifier of the blog post. For example, "croct-launches-new-sdk".

It is usually the "slug" of the post, or some other identifier that does not change.

The value must be between 1 and 100 characters long.

title
string

The title of the post. For example, "Croct launches new SDK".

The value must be between 1 and 100 characters long.

publishTime
number

The time of the post publication, in milliseconds since Unix epoch.

The value must be non-negative.

url(optional)
string

The URL of the post page.

tags(optional)
array<string>

The set of tags associated with the post. For example, "startup", "product", "dev-tools".

The value must be an array of up to 10 strings between 1 and 50 characters long.

categories(optional)
array<string>

The categories the post belongs to. For example, "news", "updates", "releases".

The value must be an array of up to 10 strings between 1 and 50 characters long.

authors(optional)
array<string>

The authors of the post. For example, "John Doe", "Jane Smith".

The value must be an array of up to 10 strings between 1 and 50 characters long.

updateTime(optional)
number

The time of the post's last update, in milliseconds since Unix epoch.

The value must be non-negative.

Processed properties

This event has no processed properties.

Payload examples

Below are some payload examples for this event:

1234567
{
"post": {
"postId": "croct-launches-new-sdk",
"title": "Croct launches new SDK",
"publishTime": 1499839200000
}
}