Who the visitor is
Tell Peekbird who a visitor is once you know. Their recordings, earlier ones included, then show their name and email, you can search by them, and their sessions on a phone and a laptop count as one person.
// When you know who the visitor is: after they log in, sign up or order.
window.peekbird = window.peekbird || [];
peekbird.push(['identify', {
id: 'CUSTOMER-123', // your own user or customer ID
email: '[email protected]',
name: 'Jane Doe'
}]);{% comment %} In layout/theme.liquid, after the snippet: {% endcomment %}
{% if customer %}
<script>
window.peekbird = window.peekbird || [];
peekbird.push(['identify', {
id: '{{ customer.id }}',
email: {{ customer.email | json }},
name: {{ customer.name | json }}
}]);
</script>
{% endif %}// In your theme's functions.php (or a code snippets plugin): logged-in users.
add_action('wp_head', function () {
if (!is_user_logged_in()) return;
$user = wp_get_current_user();
printf(
"<script>window.peekbird = window.peekbird || []; peekbird.push(['identify', %s]);</script>",
wp_json_encode([
'id' => (string) $user->ID,
'email' => $user->user_email,
'name' => $user->display_name,
], JSON_HEX_TAG | JSON_HEX_AMP)
);
}, 20);<script>
window.peekbird = window.peekbird || [];
peekbird.push(['identify', {
id: {{DLV - user_id}},
email: {{DLV - user_email}}
}]);
</script>The fields
id- Your own user or customer ID. The steadiest way to recognise someone across devices.
email- Their email address, shown in recordings and searchable.
name- How to show them. Any one of the three is enough.
When to call it
Whenever you learn who the visitor is: after they log in, sign up or place an order. On Shopify and WordPress, the code above runs on every page for logged-in customers. With Google Tag Manager, fire it when your data layer has the user, such as on a login event.
Privacy
- Peekbird never takes names or emails from what visitors type; only what you send here is stored.
- Send only details your privacy policy allows you to share with a service like Peekbird.
- For a deletion request, "Delete this visitor's data" on any of their recordings erases them, on every device identified as theirs.
- Shared recordings never show who the visitor was.