🔒
Redirecting to Secure Checkout
Please wait while we connect you to Stripe...
🔒
Redirecting to Secure Checkout
Please wait while we connect you to Stripe...
Support Partner Guides User Tracking Setup

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.

For: Partner site administrators  ·  Skill level: Basic for WordPress, Developer recommended for other platforms
💡 What This Feature Does — And Why It Helps Your Members

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.

This only affects logged-in members. Visitors who are not logged into your site are completely unaffected. They continue using the widget as anonymous visitors, exactly as before.

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.


Before You Begin
  • 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

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

  1. Log in to your WordPress Admin dashboard
  2. In the left menu, go to Plugins → Add New
  3. Click the Upload Plugin button near the top of the page
  4. Click Choose File and select the holyexplorer-user-tracking.zip file you downloaded
  5. Click Install Now
  6. Once installed, click Activate Plugin
That's it! The plugin works automatically as soon as it is activated. There is no settings page to configure. Every page on your site will now quietly make your logged-in member's WordPress user ID available to the HolyExplorer widget. For visitors who are not logged in, the value is null — no tracking occurs.

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.

  1. In your WordPress Admin, go to Code Snippets → Add Snippet
  2. Give it a name like "HolyExplorer User Tracking"
  3. Set the type to PHP Snippet
  4. Paste the following code exactly as shown:
PHP — paste into WPCode snippet
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);
  1. Set the Insert Location to Run Everywhere (or Frontend Only)
  2. Click Save and then Activate

Option 3 — Edit Your Theme Files (Developers Only)

Warning: Editing theme files directly can break your site if done incorrectly. This option is only for developers comfortable with PHP and WordPress theme development. Always use a child theme so updates do not overwrite your changes.

Add the following code to your child theme's functions.php file:

PHP — add to functions.php in your child theme
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);

🛍️ Shopify

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.

Liquid — add inside <head> in theme.liquid
<script>
window.hePartnerId = {{ customer.id | json }};
</script>
How this works: When a customer is logged into your Shopify store, {{ 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.

🐍 Django (Python)

Add the following to your base template (typically base.html), inside the <head> block, before your HolyExplorer embed code.

Django Template — add inside <head> in base.html
<script>
window.hePartnerId = {{ request.user.id|default:"null" }};
</script>
How this works: For logged-in users, Django outputs their numeric user ID. For anonymous users, |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.

💎 Ruby on Rails

Add the following to your application layout (typically app/views/layouts/application.html.erb), inside the <head> section, before your HolyExplorer embed code.

ERB — add inside <head> in application.html.erb
<script>
window.hePartnerId = <%= current_user&.id || 'null' %>;
</script>
How this works: For logged-in users, 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.

🟢 Node.js

Add the following to your main layout template, inside the <head> section, before your HolyExplorer embed code.

EJS — add inside <head> in your layout template
<script>
window.hePartnerId = <%= user ? user.id : null %>;
</script>
Note: This example uses EJS syntax. If your application uses a different template engine (Pug, Handlebars, Nunjucks, etc.), the syntax will differ. Ask your developer to adapt the expression to output the current user's ID as a JavaScript integer, or null for unauthenticated visitors.

🐘 PHP (Drupal, Joomla, Laravel, or Custom PHP)

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

PHP / Blade — Laravel
<script>
window.hePartnerId = <?php echo auth()->id() ?? 'null'; ?>;
</script>

Drupal

PHP — Drupal
<script>
window.hePartnerId = <?php echo \Drupal::currentUser()->isAuthenticated()
    ? (int)\Drupal::currentUser()->id()
    : 'null'; ?>;
</script>

Generic PHP

PHP — Generic (adapt variable name to your framework)
<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.


🔷 ASP.NET / C# (Razor)

Add the following to your layout file (typically _Layout.cshtml), inside the <head> section, before your HolyExplorer embed code.

Razor — add inside <head> in _Layout.cshtml
<script>
window.hePartnerId = "@User.FindFirstValue(System.Security.Claims.ClaimTypes.NameIdentifier)";
</script>
How this works: For authenticated users, this outputs their user identifier (which may be an integer or a GUID string depending on your identity setup). For unauthenticated visitors it outputs an empty string, which the HolyExplorer widget treats as absent — no tracking. The ClaimTypes class requires the using System.Security.Claims; namespace.

⚙️ Other Platforms

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.

JavaScript — template for any platform
<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", not 0, not an empty string

🔍 How to Verify It Is Working

Once you have completed your platform setup, you can quickly confirm it is working correctly:

  1. Log in to your website as a regular member
  2. Open a page that contains the HolyExplorer widget
  3. Right-click anywhere on the page and choose Inspect (or press F12 on your keyboard)
  4. Click the Console tab at the top of the panel that opens
  5. Type window.hePartnerId and press Enter
What you seeWhat 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

Frequently Asked Questions
Do I need to update my embed code after setting this up? +
No. When you enable Per-User Tracking in your My Configurations settings and save, your embed code is automatically updated. You only need to follow the steps in this guide to set up your website — no manual changes to the embed code itself are needed.
Will this affect visitors who are not logged in? +
No. Visitors who are not logged in are completely unaffected. They continue using the widget as anonymous visitors. The window.hePartnerId value is null for them, and the widget treats that as no tracking.
Does this change who gets billed for AI usage? +
No. All AI usage is still billed to your HolyExplorer partner account exactly as before. This feature is only about linking a visitor's session to their account for recovery and continuity purposes — it has absolutely no effect on billing.
Does this work with my WordPress membership plugin? +
Yes. All major membership plugins — Paid Memberships Pro, Ultimate Member, MemberPress, Restrict Content Pro, WooCommerce Memberships — use WordPress's native user system. Our plugin calls WordPress's standard get_current_user_id() function, which works correctly regardless of which membership plugin manages your memberships.
Can I restrict the widget to logged-in members only? +
Yes. You can use your membership plugin's access restriction settings, your page builder's visibility conditions (Divi, Elementor, Beaver Builder, etc.), or a PHP conditional to show the widget only to logged-in visitors. When you do, window.hePartnerId will always have a real user ID — no anonymous visitors will ever reach the widget.
Could a visitor fake their user ID? +
A technically sophisticated visitor could manually set 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.
What if I migrate my site to a different hosting provider? +
Nothing changes on your end. The plugin download link in your My Configurations settings is hosted independently of the HolyExplorer application server. If HolyExplorer ever changes its own hosting, your download link and embed code remain unaffected.

🔒 Privacy Information
QuestionAnswer
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