Partner User Tracking
Setup Guide
Enable per-user session tracking so your logged-in members never lose their Digital Media assets — even after clearing browser cookies.
When a visitor uses the HolyExplorer widget on your site, their session is tracked using a browser cookie. This works well in most cases — but if a visitor clears their cookies or switches devices, their session history (including any Digital Media assets they created) cannot be recovered, because there is no other way to identify them.
Per-User Tracking solves this. When your site is set up correctly, HolyExplorer can recognize a logged-in member by their internal user ID even after their cookie is gone. Their Digital Media assets and conversation history are linked to their account, not just their browser — so the experience is seamless.
All AI usage is still billed to your HolyExplorer partner account as normal. This feature has no effect on billing — it is purely about session recovery and linking activity to a specific member account.
- You must have already enabled Per-User Tracking in your My Configurations settings on HolyExplorer.com. Do that first — your embed code is automatically updated when you save the setting.
- This feature requires that your website has a user login system. If your visitors browse anonymously and never log in, this feature does not apply to your site.
- WordPress sites: No developer is needed. Follow the steps in the WordPress section below.
- All other platforms: You or your developer will need to add a short code snippet to your site's page templates. Share this guide with your developer if needed.
WordPress is fully supported with a simple plugin. Most WordPress partners should use Option 1 — it requires no coding and takes about two minutes.
Option 1 — Install the HolyExplorer Tracking Plugin (Recommended)
This is the easiest option and is recommended for all WordPress site administrators.
Step 1: Download the plugin
In your My Configurations settings on HolyExplorer.com (the same screen where you enabled Per-User Tracking), you will find a Download Plugin button. Click it to download holyexplorer-user-tracking.zip to your computer. Do not unzip it — WordPress needs the zip file as-is.
Step 2: Upload and activate the plugin
- Log in to your WordPress Admin dashboard
- In the left menu, go to Plugins → Add New
- Click the Upload Plugin button near the top of the page
- Click Choose File and select the
holyexplorer-user-tracking.zipfile you downloaded - Click Install Now
- Once installed, click Activate Plugin
Compatibility: Works with all major WordPress membership and access-restriction plugins including Paid Memberships Pro, Ultimate Member, MemberPress, Restrict Content Pro, and WooCommerce Memberships. Also compatible with all major page builders including Divi, Elementor, Beaver Builder, Oxygen, and Bricks.
Option 2 — Use WPCode (If You Already Have It Installed)
If your site already uses WPCode (a free code snippet manager with 1 million+ installs), you can use it instead of installing our plugin.
- In your WordPress Admin, go to Code Snippets → Add Snippet
- Give it a name like "HolyExplorer User Tracking"
- Set the type to PHP Snippet
- Paste the following code exactly as shown:
add_action('wp_head', function() {
$user_id = get_current_user_id();
$js_value = $user_id > 0 ? (int) $user_id : 'null';
echo '<script>window.hePartnerId = ' . $js_value . ';</script>';
}, 1);- Set the Insert Location to Run Everywhere (or Frontend Only)
- Click Save and then Activate
Option 3 — Edit Your Theme Files (Developers Only)
Add the following code to your child theme's functions.php file:
add_action('wp_head', function() {
$user_id = get_current_user_id();
$js_value = $user_id > 0 ? (int) $user_id : 'null';
echo '<script>window.hePartnerId = ' . $js_value . ';</script>' . "\n";
}, 1);Add the following code to your Shopify theme's theme.liquid file, inside the <head> section, before your HolyExplorer embed code.
Your developer can add this via Online Store → Themes → Edit Code → Layout → theme.liquid.
<script>
window.hePartnerId = {{ customer.id | json }};
</script>{{ customer.id | json }} outputs their numeric customer ID. When a visitor is not logged in, it outputs null. The | json filter ensures the output is always valid JavaScript regardless of the customer's login status.Add the following to your base template (typically base.html), inside the <head> block, before your HolyExplorer embed code.
<script>
window.hePartnerId = {{ request.user.id|default:"null" }};
</script>|default:"null" outputs the JavaScript null value, which disables tracking for that visitor.Requirement: The
django.template.context_processors.auth processor must be enabled in your TEMPLATES settings — it is enabled by default in new Django projects.Add the following to your application layout (typically app/views/layouts/application.html.erb), inside the <head> section, before your HolyExplorer embed code.
<script> window.hePartnerId = <%= current_user&.id || 'null' %>; </script>
current_user&.id outputs their numeric ID. For visitors who are not logged in, current_user is nil and the expression outputs null. Works with Devise, Authlogic, and any authentication library that provides a current_user helper.Add the following to your main layout template, inside the <head> section, before your HolyExplorer embed code.
<script> window.hePartnerId = <%= user ? user.id : null %>; </script>
null for unauthenticated visitors.The exact code depends on how your PHP application manages user authentication. Add a <script> tag to your page layout before your HolyExplorer embed code, using the version that matches your framework:
Laravel
<script> window.hePartnerId = <?php echo auth()->id() ?? 'null'; ?>; </script>
Drupal
<script>
window.hePartnerId = <?php echo \Drupal::currentUser()->isAuthenticated()
? (int)\Drupal::currentUser()->id()
: 'null'; ?>;
</script>Generic PHP
<script>
window.hePartnerId = <?php echo isset($current_user->id)
? (int)$current_user->id
: 'null'; ?>;
</script>If you are unsure which variable to use, ask your developer — the goal is to output the logged-in user's numeric ID, or the literal text null (without quotes) if no user is logged in.
Add the following to your layout file (typically _Layout.cshtml), inside the <head> section, before your HolyExplorer embed code.
<script> window.hePartnerId = "@User.FindFirstValue(System.Security.Claims.ClaimTypes.NameIdentifier)"; </script>
ClaimTypes class requires the using System.Security.Claims; namespace.If your platform is not listed above, ask your developer to add a <script> tag to the page layout before your HolyExplorer embed code. The tag should set window.hePartnerId to the current logged-in user's ID as an integer, or null for visitors who are not logged in.
<script> window.hePartnerId = CURRENT_USER_ID_OR_NULL; </script>
The three key requirements are:
- The value is generated on the server when the page loads — not fetched asynchronously after the page loads
- The script tag is placed before the HolyExplorer embed code in the page
- Logged-out visitors receive the JavaScript value
null— not the string"null", not0, not an empty string
Once you have completed your platform setup, you can quickly confirm it is working correctly:
- Log in to your website as a regular member
- Open a page that contains the HolyExplorer widget
- Right-click anywhere on the page and choose Inspect (or press F12 on your keyboard)
- Click the Console tab at the top of the panel that opens
- Type
window.hePartnerIdand press Enter
| What you see | What it means |
|---|---|
7 (or any number) | ✅ Working correctly — this is your member's user ID |
null | ⚠️ The visitor is not logged in, or the setup is not active — check that you are logged in and the plugin or snippet is activated |
undefined | ❌ The plugin or code snippet is not running on this page — check that it is installed and active |
window.hePartnerId value is null for them, and the widget treats that as no tracking.get_current_user_id() function, which works correctly regardless of which membership plugin manages your memberships.window.hePartnerId will always have a real user ID — no anonymous visitors will ever reach the widget.window.hePartnerId in their browser console to a different value. In the current version, the backend accepts the value at face value. Spoofing the session recovery ID provides no meaningful benefit to an attacker — it would only allow them to attempt to link to another user's session, and only if that other user has also enabled tracking. A future version may add cryptographic signing to prevent this entirely.| Question | Answer |
|---|---|
| What data is shared? | Only your member's internal numeric user ID (for example, 7). No name, email address, or any other personal information is included. |
| When is it transmitted? | Only when a visitor actively uses the widget on your page. Simply having the plugin active does not send any data anywhere. |
| Is this GDPR compliant? | A numeric user ID can be considered personal data under GDPR because it can be linked back to a specific person in your system. You should disclose in your site's Privacy Policy that you use the HolyExplorer AI service and that logged-in members' internal account ID is shared with HolyExplorer to enable session continuity. HolyExplorer's Privacy Policy governs how that data is stored and retained on our end. |
| Is any data exposed publicly? | No. The user ID is a private value passed from your server to the HolyExplorer widget running on your page. It is not visible to other visitors or exposed in any public-facing way. |
Need Help Getting Set Up?
Our support team is happy to guide you through the setup process for your specific platform.
Contact Support