PHPackages                             symbiote/silverstripe-local-personalisation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. symbiote/silverstripe-local-personalisation

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

symbiote/silverstripe-local-personalisation
===========================================

Builds a profile of a site user in their browser, to be used for content personalisation

1.2.0(5y ago)31372BSD-3-ClauseJavaScript

Since Nov 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/nyeholt/silverstripe-local-personalisation)[ Packagist](https://packagist.org/packages/symbiote/silverstripe-local-personalisation)[ RSS](/packages/symbiote-silverstripe-local-personalisation/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

Local Profiles
==============

[](#local-profiles)

[![Build Status](https://camo.githubusercontent.com/f13201e7652d91aeb9377f1c142289803b5152300b51f329143a43368852c0cd/68747470733a2f2f7472617669732d63692e6f72672f73796d62696f74652f73696c7665727374726970652d6c6f63616c2d70726f66696c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/symbiote/silverstripe-local-profile)[![Latest Stable Version](https://camo.githubusercontent.com/d2e97394f82e05bec9a49795a0e03a2683f265295a65ca76d026381f0d37b7c4/68747470733a2f2f706f7365722e707567782e6f72672f73796d62696f74652f73696c7665727374726970652d6c6f63616c2d706572736f6e616c69736174696f6e2f76657273696f6e2e737667)](https://github.com/symbiote/silverstripe-local-personalisation/releases)[![Latest Unstable Version](https://camo.githubusercontent.com/628bf2321bc700b75bd3aadafe1b08e440187c6c2fd8017dac41b0d0ae07cd21/68747470733a2f2f706f7365722e707567782e6f72672f73796d62696f74652f73696c7665727374726970652d6c6f63616c2d706572736f6e616c69736174696f6e2f762f756e737461626c652e737667)](https://packagist.org/packages/symbiote/silverstripe-local-personalisation)[![Total Downloads](https://camo.githubusercontent.com/baa0c7df61807b0ee8437e99a34d259f562f64e8ab6b72bce864ce1b111da0bd/68747470733a2f2f706f7365722e707567782e6f72672f73796d62696f74652f73696c7665727374726970652d6c6f63616c2d706572736f6e616c69736174696f6e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/symbiote/silverstripe-local-personalisation)[![License](https://camo.githubusercontent.com/6cf78b57d84f215e90f7e68eb8cc0813d6da211ce4a42c907741238429bf1e48/68747470733a2f2f706f7365722e707567782e6f72672f73796d62696f74652f73696c7665727374726970652d6c6f63616c2d706572736f6e616c69736174696f6e2f6c6963656e73652e737667)](https://github.com/symbiote/silverstripe-local-personalisation/blob/master/LICENSE.md)

Overview
--------

[](#overview)

Builds a profile of a visitor, "tagging" behaviour based on the pages visited, actions performed, location, or device characteristics. Preserves privacy since the profile is stored in the browser only, without relying on server data or logged-in user information.

This module enables marketers and developers to collaborate effectively, by providing both a CMS user interface and an API.

CMS users can define "rule sets" to group one or more "rules". Each rule determines when and how behaviour should be tagged. For example, "if URL contains 'marketing', then add 'interested-in-marketing' tag".

These tags can then be used for matching rules against objects managed in the CMS (such as pages or content blocks), and show/hide them based on in-browser decisions. Alternatively, you can control this behaviour programmatically, enabling sophisticated rule definitions that wouldn't be feasible in a CMS UI.

Because all decision making happens in the browser, you can still serve cached responses with all variations delivered to the browser, but only some variations shown to the visitor.

Example use cases:

- Show location-specific announcements on the homepage
- List featured products from the closest store (via browser geolocation)
- Show topic-specific content blocks based on the pages the visitor has previously viewed
- Show promotions for a specific marketing campaign, based on traffic coming in with a campaign URL parameter
- Hide welcome message if the visitor has seen it before
- Show "Contact helpdesk?" call-to-action if visitors view a FAQ entry for longer than 30 seconds

Limitations:

- All variations are visible to all visitors (for example, this can't be used for targeted promo codes)
- All decision making is visible in the browser (including any built-in bias and dodgy marketing tactics)

Installation
------------

[](#installation)

### Composer

[](#composer)

```
composer require symbiote/silverstripe-local-personalisation:~1.0

```

### Javascript and CSS

[](#javascript-and-css)

Add the required frontend logic into your main template:

```

```

Alternatively, check `app/webpack.config.js` on how to compile the requirements into your own frontend bundle.

### Metadata

[](#metadata)

Personalisation rules are loaded as JavaScript metadata.

```

```

By loading this as a separate route, you avoid inline scripts and make it easier to secure your website with a [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP). It also helps with caching: Personalisation rules apply immediately on save, even when the page output might be cached (via HTTP caching or static publishing).

### Apply the extension

[](#apply-the-extension)

In order for the frontend logic to be triggered, you generally want to apply an extension to at least one content object. This adds a new "Personalisation" tab in the CMS.

Apply on pages:

```
SilverStripe\CMS\Model\SiteTree:
  extensions:
    - Symbiote\Personalisation\PersonalisationExtension
```

Apply on [content blocks](https://github.com/silverstripe/silverstripe-elemental):

```
DNADesign\Elemental\Models\BaseElement:
  extensions:
    - Symbiote\Personalisation\PersonalisationExtension
```

### Modify templates

[](#modify-templates)

Now add some metadata to the markup for the content object you're rendering: `$p13nClasses` to your `class` attribute, and `$p13nAttributes` to the element.

Example for the content blocks holder template (store in `themes/mytheme/templates/DNADesign/Elemental/Layout/ElementHolder.ss`):

```

	$Element

```

### Test Operation

[](#test-operation)

You should be ready to define rules now. Check for `Profile.js` console messages in your browser to ensure everything is set up correctly.

Developer Usage
---------------

[](#developer-usage)

### Rules for profile segmentation

[](#rules-for-profile-segmentation)

Rules are defined in the CMS

They can be triggered for;

- A regex match against content

### Manually applying rules

[](#manually-applying-rules)

By applying the `PersonalisationExtension` to a content object, you can use `$p13nClasses` and `$p13nAttributes` in your templates.

Alternatively, you can build the required markers from scratch:

- add the `lp-item css` class
- Add the `data-lp-tags` attribute to list (comma separated) the tags applied on the profile to trigger this element
- Add the `data-lp-type` attribute to indicate whether to "show" (default) or "hide" the element
- Add the `data-lp-times` attribute (optional) to indicate how many times the user's profile has to have been tagged
- Add the `data-lp-timeframe` attribute to indicate what timeframe (ie `-1 week`) the tagging must have happened

```

    What this is

```

Events
------

[](#events)

The following events are triggered and can be responded to in custom code

- `local_profile_match_tag`
- `local_profile_apply_rule`
- `local_profile_add_tag`

Bind to these as `document.addEventListener('local_profile_add_tag', function (eventData) {})`

Local Development
-----------------

[](#local-development)

### Build

[](#build)

The frontend assets are stored in `app/`. You can use `yarn` to install dependencies and kick off a build:

```
cd app/
yarn install
yarn build

```

### Javascript, HTTPS and hot reloading

[](#javascript-https-and-hot-reloading)

To fully test the functionality locally, you'll need to run your webserver on HTTPS which is required for geolocation in most browsers now.

When developing the Javascript code for the module, it can be helpful to get source maps (breakpoints!) and hot reloading. The module already has a `yarn devserver` command. You'll need to extend the `webpack.config.js`to work around CORS issues when including it in your page (see [webpack devserver docs](https://webpack.js.org/configuration/dev-server/#devserverhttps)).

```
module.exports = {
    // ...
    devServer: {
        disableHostCheck: true
    }
};
```

Now you can use the dev server (usually on port `4200`) with the preferred hostname for your Silverstripe website:

```

```

Caution: In order to use geolocation without HTTPS in Chrome, you need to [allow insecure origins](https://stackoverflow.com/questions/39366758/geolocation-without-ssl-connection).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~63 days

Total

3

Last Release

1868d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/25cb1c56a7ab949d1e6b28a2a04862ce1cffe1799a291e1797f8dfd33cd83716?d=identicon)[nyeholt](/maintainers/nyeholt)

---

Top Contributors

[![nyeholt](https://avatars.githubusercontent.com/u/161730?v=4)](https://github.com/nyeholt "nyeholt (41 commits)")[![amirsymbiote](https://avatars.githubusercontent.com/u/52026049?v=4)](https://github.com/amirsymbiote "amirsymbiote (3 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (3 commits)")

---

Tags

silverstripeprofilepersonalisation

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/symbiote-silverstripe-local-personalisation/health.svg)

```
[![Health](https://phpackages.com/badges/symbiote-silverstripe-local-personalisation/health.svg)](https://phpackages.com/packages/symbiote-silverstripe-local-personalisation)
```

###  Alternatives

[silverstripe/multi-domain

Allows multiple domains to access one CMS instance, mapping them to different sections of the hierarchy

141.6k](/packages/silverstripe-multi-domain)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
