Enable page view signals in the Connect web library
The page view signal captures when users view pages on your website. This is the easiest signal to implement and provides foundational tracking for user navigation patterns.
Reasons to enable:
- Track navigation patterns across your site
- Understand which pages and categories receive most traffic
- Identify drop-off points in user journeys
- Segment users based on content consumption
Availability: Premium and Ultimate
Implementation considerations
What constitutes a page view
A page view occurs when content is loaded or reloaded for the user. This typically includes:
- Full page loads (traditional navigation)
- Page reloads
- Browser back/forward navigation to cached pages
For single-page applications, you may need to trigger signals manually when content changes significantly, even if the browser doesn't perform a full page load.
Data collection strategies
- From URL - Capture the current page URL from the browser address bar (
window.location.href). You can extract page category from structured URLs (for example,/clothing/shirts/→ category: "clothing"). - From data layer - If your website has a data layer, extract URL and category information from there for more reliable data.
- From page content - Scrape category information from page elements like breadcrumbs, navigation or meta tags.
URL handling
Consider these URL scenarios:
- Query strings - Decide whether to include or strip query parameters.
- Fragments - Handle hash fragments for single-page applications
- Trailing slashes - Normalize URLs for consistent tracking
Contact mapping
Any signal can be mapped to a contact. Use the audience object to provide a customer ID (contact key) or an addressable attribute (email or phone number). You can provide several identification records in the same signal — for example, a contact key and an email address. For details on how Connect processes identification records, see How behavior signals are processed in Connect.
Several sources of identification are available:
- User identification stored in browser cookies
- Temporary session-based storage
- Persistent client-side storage
- Data layer (for example, Google Tag Manager
dataLayer) - URL parameters passed during navigation
- Login API monitoring (capture identifier during successful authentication)
If none of these options are available, work with your development team to make the identifier accessible to the Connect library.
Important
We recommend attaching identifiers to as many signals as possible. However, if an identifier is missing, the system falls back on other signals from the same user session in order to identify the website visitor.
Configuration
Method
TLT.logSignal(signalObject)
Sends the signal to the Acoustic Connect endpoint as a JSON object. The Connect library must be initialized before calling this method.
Signal structure
Top-level fields
audience: Array of objects - Create an object for contact mapping and any number of additional objects to update contact attributes.category: String - Valid value -Behavior.consent: Object - Consent preferences to update for the contact. At least one of the following channel fields is required:email,smsorwhatsapp.description: String - Description of the signaleffect: String - Describes the effect of the signal on engagement. Valid values:negative,positive. Usepositivefor standard page views.name: String - Name to differentiate this signal from others (for example, "Page view from website"). Max length - 256 chars.signalType(required): String - Valid value -pageView.
Audience object
Create an object with one or more identifiers for contact mapping (recommended) and any number of additional objects for other contact attributes you want to update.
name(required): String - Name of contact attribute. To get the full list of available attributes, use the Contact attributes query.value: The new value of the contact attribute. Its format depends on the attribute type (text, number, Boolean or date). If you send an empty or null value, it will be ignored and the contact attribute won't be updated.
Note
- For date attributes, use the following format:
yyyy-MM-dd'T'HH:mm:ssXXX.- For phone number attributes, use the ISO E.164 format:
+[country code][area code][phone number]— no spaces, dashes or special characters. If the+symbol is omitted, Connect adds it automatically.
- Consent object
Each channel accepts multiple entries to set different consent statuses per consent group in a single call.
enableOverrideExistingOptOut(required): Boolean - Whentrue, current opt-out statuses will be overridden by new statuses. Whenfalse, contacts who have unsubscribed from communications won't have their consent status updated.email: Array of objects - Consent entries for the email channel. The objects support the following fields:status(required): Enum - Consent status for the email channel. Valid values:OPT_IN,OPT_OUT,OPT_IN_UNVERIFIED.consentGroupIds: Array of strings - The IDs of consent groups a new status applies to. If you skip this field or send an empty array, the new consent status will be applied to all consent groups.
sms: Array of objects - Consent entries for the SMS channel. The objects support the following fields:status(required): Enum - Consent status for the SMS channel. Valid values:OPT_IN,OPT_OUT,OPT_IN_UNVERIFIED.consentGroupIds: Array of strings - The IDs of consent groups a new status applies to. If you skip this field or send an empty array, the new consent status will be applied to all consent groups.
whatsapp: Array of objects - Consent entries for the WhatsApp channel. The objects support the following fields:status(required): Enum - Consent status for the WhatsApp channel. Valid values:OPT_IN,OPT_OUT,OPT_IN_UNVERIFIED.consentGroupIds: Array of strings - The IDs of consent groups a new status applies to. If you skip this field or send an empty array, the new consent status will be applied to all consent groups.
Note
To get the IDs of consent groups, use the dataSets query.
Signal content
pageCategory: String - The category that the page belongs to (for example, "clothing", "electronics", "about"). Can be parsed from the URL or extracted from the data layer.pageGroup: String - A grouping for related pagesurl(required): String - The URL of the page the user has opened
Note:
- If any required field is missing or invalid, the entire signal will be discarded.
- Optional fields enhance the signal. They won't prevent processing if omitted or invalid.
Basic example
// Initialize the Connect library
if (window.TLT) {
TLT.initPremium({
appKey: "APP_KEY",
postUrl: "COLLECTOR_URL",
callback: function() {
const signal = {
// Required fields
signalType: "pageView",
category: "Behavior",
name: "pageView from website",
url: "https://example.com/clothing/shirts",
effect: "positive",
// Contact mapping
audience: [
{
name: "Customer ID",
value: "AAUN-1417508"
}
],
// Optional fields
pageCategory: "clothing",
pageGroup: "products"
};
// Send the signal
TLT.logSignal(signal);
}
});
}
Complete implementation example
This example demonstrates multiple approaches to extracting page category. The audience identifier is retrieved from the data layer.
// Initialize the Connect library
if (window.TLT) {
TLT.initPremium({
appKey: "APP_KEY",
postUrl: "COLLECTOR_URL",
callback: function() {
const signal = {
signalType: "pageView",
category: "Behavior",
name: "pageView generated by website",
url: window.location.href.split("?")[0],
pageCategory: "",
pageGroup: "",
effect: "positive"
};
// Add contact mapping from the data layer
const customerId = window.dataLayer?.customerId;
if (customerId) {
signal.audience = [
{
name: "Customer ID",
value: customerId
}
];
}
// Method 1: Extract from URL path structure
const pathSegments = window.location.pathname.split("/").filter((segment) => segment);
if (pathSegments.length > 0) {
signal.pageCategory = pathSegments[0];
} else {
signal.pageCategory = "home";
}
// Method 2: Override with data layer if available
if (window.dataLayer?.pageCategory) {
signal.pageCategory = window.dataLayer.pageCategory;
}
// Method 3: Override with page-specific meta tag
const categoryMeta = document.querySelector('meta[name="page-category"]');
if (categoryMeta) {
signal.pageCategory = categoryMeta.getAttribute("content");
}
// Method 4: Use breadcrumb navigation
if (!signal.pageCategory || signal.pageCategory === "home") {
const breadcrumb = document.querySelector(".breadcrumb li:nth-child(2)");
if (breadcrumb) {
signal.pageCategory = breadcrumb.innerText.toLowerCase().trim();
}
}
// Handle special cases
if (signal.url.includes("/search")) {
signal.pageCategory = "search results";
} else if (signal.url.includes("/cart") || signal.url.includes("/checkout")) {
signal.pageCategory = "checkout";
} else if (signal.url.includes("/account") || signal.url.includes("/profile")) {
signal.pageCategory = "account";
}
// Optional: Log signal for debugging
console.log("pageView signal:", JSON.stringify(signal, undefined, 2));
// Send signal to Acoustic
TLT.logSignal(signal);
}
});
}
Best practices
- Make sure the signal triggers consistently across all pages of your site.
- Normalize the URLs. Strip query parameters and fragments if they don't represent unique content.
- Standardize category names across your site (lowercase, no special characters).
- Handle special pages such as search results, checkout and error pages with specific category values.
- Test the signal on standard pages and after dynamic content loads.
Troubleshooting
Signal not firing on some pages?
- Verify the Connect library loads and initializes on all pages.
- Check that your signal code executes after library initialization.
- Ensure no JavaScript errors prevent the signal code from running.
- Test on static and dynamic pages.
URL not captured correctly?
- Check if query parameters should be included or stripped.
- Test with different URL formats (trailing slashes, multiple path segments).
- Use
window.location.hreffor full URL orwindow.location.pathnamefor path only.
Page category empty or incorrect?
- Make sure URL structure matches your extraction logic.
- Test fallback methods if primary extraction fails.
- Check for typos in path segment indexes.
- Consider using data layer as primary source if available.
Duplicate signals on single page load?
- Check if signal code runs multiple times.
- For single-page applications, ensure signals only fire once per route change.
- Consider debouncing or adding flags to prevent duplicates.
Related pages
Updated 6 days ago
