NAME
PrivatusAnalytics::Attributes - data attributes for Privatus Analytics events and click maps
SYNOPSIS
use PrivatusAnalytics::Attributes qw(event_attrs click_attr);
my $html = event_attrs('Report exported', { format => 'csv' });
# data-privatus-event="Report exported" data-privatus-prop-format="csv"
my $click = click_attr('pricing.cta');
# data-privatus-click="pricing.cta"
DESCRIPTION
Plain Perl, no framework needed. PrivatusAnalytics and the framework plugins wrap these functions. See PrivatusAnalytics for the rules.
FUNCTIONS
- event_data($name, \%props | \@pairs | %props)
-
A list of attribute name and value pairs. An empty list for an empty name.
- event_attrs($name, ...)
-
The same attributes as escaped HTML.
- click_data($name)
-
('data-privatus-click' => $name), or an empty list when the name is not valid. - click_attr($name)
-
The click attribute as HTML, or an empty string.
- valid_click_name($name)
-
True when the name uses only letters, digits and
_ . : -, up to 100 characters. - html_escape($text)
-
Escapes
& < > " '.
LICENSE
MIT. Copyright (c) 2026 Two Phase LLC.