Tell the seller while the pricing page is open
Someone at an account has opened the pricing page three times this week, and each time the plan they compared was the team plan. The lead score picks this up in the next scoring run, and the seller reads it after the buyer has closed the tab and gone back to work. The moment to reach them is now, with the plan they looked at in the first line of the message.
pricing_views_7d- Times anyone at this account opened the pricing page in the last seven days
plan_viewed_7d- The plan they compared most in the last seven days
Posts the account to the seller's queue the moment this week's pricing views reach three, with the plan they compared most, so the first message names it.
from datetime import timedelta
from snowplow_signals import (
Attribute, AttributeKey, AtomicProperty, Criteria, Criterion, EntityProperty, Event, StreamAttributeGroup,
)
page_view = Event(name="page_view", vendor="com.snowplowanalytics.snowplow", version="1-0-0")
on_pricing = Criteria(all=[Criterion.like(AtomicProperty(name="page_url"), "%/pricing%")])
account = AttributeKey(
name="account",
property=EntityProperty(vendor="com.example", name="account", major_version=1, path="id"),
)
pricing_views_7d = Attribute(
name="pricing_views_7d",
type="int32",
events=[page_view],
aggregation="counter",
criteria=on_pricing,
period=timedelta(days=7),
default_value=0,
)
# The pricing page attaches the plan being compared as a plan entity on each page view.
plan_viewed_7d = Attribute(
name="plan_viewed_7d",
type="string",
events=[page_view],
aggregation="most_frequent",
property=EntityProperty(vendor="com.example", name="plan", major_version=1, path="name"),
criteria=on_pricing,
period=timedelta(days=7),
)
# Keyed on the account, so one read covers everyone logged in under it.
saas_handoff_pricing = StreamAttributeGroup(
name="saas_handoff_pricing",
version=1,
attribute_key=account,
owner="you@example.com",
attributes=[pricing_views_7d, plan_viewed_7d],
)// In the job that posts account activity to your CRM
const account = await signals.getServiceAttributes({
name: "saas_handoff_pricing",
attribute_key: "account",
identifier: accountId,
});
// { pricing_views_7d: 3, plan_viewed_7d: "team" }
if (account.pricing_views_7d >= 3) {
crm.notify({
account: accountId,
to: "account_owner",
note: `Opened pricing ${account.pricing_views_7d} times this week, comparing the ${account.plan_viewed_7d} plan`,
});
}