Skip to main content

Page Viewed

When to Use

Trigger this event on each route change in Single Page Applications (SPA) where URL changes don't trigger automatic page loads. For standard multi-page websites, page views are tracked automatically by the DATA Reshape script — this event is not needed.

Complete Reference

event object required

name string required

info

Use only static value page_viewed for event.name.

name: "page_viewed"

value number required

info

Set to 0 for page views.

value: 0

currency string required

info

Currency code. Use your default currency.

currency: "EUR"

context object required

info

Context is required for this event — provide the current route URL and page type. View complete Context Object documentation

url string required-if-applicable

info

Collected automatically for standard websites. Required only for SPA applications where URL changes don't trigger automatic page context updates.

url:"https://shop.example.com/products/laptop?color=silver&storage=512gb&utm_source=google"
warning

URL Parameter Sensitivity: Be mindful of sensitive information in URLs. Query parameters may contain personal identifiers, session tokens, or private information that should be handled according to privacy regulations.

page_type string recommended

info

Type of page (product, home ...)

page_type: "product"

environment string recommended

info

Allowed values: prod, dev

environment: "prod"

user object recommended

id string recommended

info

Unique customer identifier in your system.

id: "CUSTOMER_INTERNAL_ID"

email string recommended

info

Customer email address(es) provided in plaintext or as SHA-256 hashed values.

email: "[email protected]" 
// or
email: "3e1ufd1rdnh8l1rfz6xlreyw2yryd4zrf8zsk1pxh2x8wbsp2mw1g93rs5nx68dq"

phone string recommended

info

Customer phone number(s) in E.164 format (plaintext) or as SHA-256 hashed values.

phone: "+40712345678"
// or
phone: "unw5r66oikql4n4tlg2c54bkd2npephsbwwhxuoxreu6ph8uv6k424y9x15opy9y"

first_name string recommended

info

Customer first name

first_name: "John"

last_name string recommended

info

Customer last name

last_name: "Doe"

country string

info

Country name or ISO country code

country: "Romania"

region string recommended

info

State, province, or region name

region: "Bucuresti"

city string recommended

info

City or locality name

city: "Bucuresti"

street string

info

Street address including number

street: "Strada Principala 1"

postal_code string

info

Postal code or ZIP code

postal_code: "700000"

orders_total_number number recommended

info

Cumulative number of orders placed by this user

orders_total_number: 5

orders_canceled_number number recommended

info

Cumulative number of orders placed and canceled by this user

orders_canceled_number: 0

orders_total_value number recommended

info

Cumulative lifetime user orders value (decimal format: 2500.50)

orders_total_value: 1234.99

orders_refunded_value number recommended

info

Cumulative lifetime user orders value canceled (decimal format: 2500.50)

orders_refunded_value: 250.99

predicted_value number

info

Predicted lifetime value of a customer for your business

predicted_value: 100.99

created_at number recommended

info

Timestamp in milliseconds since Unix epoch representing the first time the user was recorded

created_at: 1754926521690

properties object recommended

info

Custom Customer Properties Examples

User Segmentation

Use the properties object to store custom user attributes, with property names defined by each business as needed, that enable advanced segmentation, personalization, and analytics across your marketing campaigns.

properties: {
customer_type: "returning",
membership_level: "platinum",
preferred_category: ["electronics", "fashion"],
last_purchase_date: "2024-12-15",
average_order_value: "350.00",
payment_method_preference: "card",
registration_date: "2023-06-15"
}

Examples

window.reshape = window.reshape || [];
reshape.push({
"event": {
"name": "page_viewed",
"value": 0,
"currency": "EUR"
},
"context": {
"url": "https://shop.example.com/electronics/cameras",
"page_type": "category",
"environment": "prod"
},
"user": {
"id": "CUST_12345",
"email": "[email protected]",
"phone": "+40712345678",
"first_name": "Alexandru",
"last_name": "Popescu",
"country": "RO",
"region": "Brasov",
"city": "Brasov",
"orders_total_number": 8,
"orders_canceled_number": 1,
"orders_total_value": 2156.75,
"orders_refunded_value": 299.99,
"predicted_value": 3500.00,
"created_at": 1640995200000,
"properties": {
"customer_segment": "loyal",
"acquisition_channel": "paid_search",
"loyalty_tier": "gold"
}
}
});
info

For standard (non-SPA) websites, page views are tracked automatically. Use this event only in SPA frameworks where you need to manually notify DATA Reshape of route changes.