All Projects → Groucho → groucho

Groucho / groucho

Licence: MIT license
Know all your users. Scalable front-end (anon) personalization & attribution

Programming Languages

javascript
184084 projects - #8 most used programming language
API Blueprint
66 projects
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to groucho

Bin
A tiny (<1kb) localStorage and sessionStorage helper library.
Stars: ✭ 70 (+125.81%)
Mutual labels:  localstorage, javascript-library
Remotestorage.js
⬡ JavaScript client library for integrating remoteStorage in apps
Stars: ✭ 2,155 (+6851.61%)
Mutual labels:  localstorage, javascript-library
cerbero
Track your users interactions
Stars: ✭ 56 (+80.65%)
Mutual labels:  tracking, javascript-library
amazing-javascript-2019
48 Amazing JavaScript Open Source for the Past Year (v.2019)
Stars: ✭ 23 (-25.81%)
Mutual labels:  javascript-library
ReactNativeWorkshop
Demo project using React Native technology to create a simple iOS app to find music in iTunes
Stars: ✭ 55 (+77.42%)
Mutual labels:  javascript-library
ngx-metrika
Angular Yandex Metrika (Модуль поддержки счетчиков Яндекс Метрика для Angular 6+)
Stars: ✭ 13 (-58.06%)
Mutual labels:  tracking
BlazoredLocalStorage
This library has been moved to the Blazored org
Stars: ✭ 26 (-16.13%)
Mutual labels:  localstorage
Covid19-Tracker
The situation of the Coronavirus epidemic data around the World and details info in Vietnam.
Stars: ✭ 15 (-51.61%)
Mutual labels:  localstorage
vue-storage-watcher
a reactive storage plugin for vue 👀🔭
Stars: ✭ 60 (+93.55%)
Mutual labels:  localstorage
website-fingerprinting
Deanonymizing Tor or VPN users with website fingerprinting and machine learning.
Stars: ✭ 59 (+90.32%)
Mutual labels:  anonymous-users
shikijs
A JavaScript Library for Syntax Highlighting with Awesome themes
Stars: ✭ 21 (-32.26%)
Mutual labels:  javascript-library
Atomic-GRUB2-Theme
Theme for the Grub2 at the purest ATOMIC style
Stars: ✭ 83 (+167.74%)
Mutual labels:  personalization
party-js
A JavaScript library to brighten up your user's site experience with visual effects!
Stars: ✭ 858 (+2667.74%)
Mutual labels:  javascript-library
COVID-19-tracker
北航大数据高精尖中心研究团队进行数据来源的整理与获取,利用自然语言处理等技术从已公开全国4626确诊患者轨迹中抽取了基本信息(性别、年龄、常住地、工作、武汉/湖北接触史等)、轨迹(时间、地点、交通工具、事件)及病患关系形成结构化信息
Stars: ✭ 75 (+141.94%)
Mutual labels:  tracking
local-storage-fallback
Check and use appropriate storage adapter for browser (localStorage, sessionStorage, cookies, memory)
Stars: ✭ 103 (+232.26%)
Mutual labels:  localstorage
jsGBC
👾 A GameBoy Color Emulator written in JavaScript
Stars: ✭ 44 (+41.94%)
Mutual labels:  localstorage
MLweb
Machine learning and scientific computing (linear algebra, statistics, optimization) javascript libraries, with an online lab.
Stars: ✭ 85 (+174.19%)
Mutual labels:  javascript-library
plug-react
React components and hooks to plug your React applications into Croct.
Stars: ✭ 76 (+145.16%)
Mutual labels:  personalization
smashblock
📡 🛡️A self-updating extensive blocklist filter for AdGaurd. Be sure to 🌟 this repository for updates!
Stars: ✭ 66 (+112.9%)
Mutual labels:  tracking
form-saver
A simple script that lets users save and reuse form data.
Stars: ✭ 67 (+116.13%)
Mutual labels:  localstorage

Groucho Build Status Test Coverage Code Climate

Know more about your anonymous users. Scalable front-end personalization.

This library uses in-browser localStorage to track people. Client-side activities are stashed, which rely on the presence of on-page meta data in the dataLayer. This is useful for working with heavily cached, non-user-unique pages and adding personalized front-end features on top. Size: just 2k!

Full documentation

Dependencies

  1. Selector library, one of...
  • jQuery - JS library standard.
    • Tested: 1.5.2, 1.6.4, 1.7.2, 1.8.3, 1.9.1, 1.10.2, 1.11.1, 2.0.3, 2.1.1, 2.1.4
  • Zepto - Minimal jQuery alternative (core, callbacks, deferred).
    • Tested: 1.1.0, 1.1.4, 1.1.6
  1. In-browser storage abstraction library. Configurable! Tested with...
  • jStorage - localStorage or userData [8k].
    • Tested: 0.4.12
  • Store.js - localStorage, globalStorage, and userData [3k].
    • Tested: 1.3.17
  • simpleStorage - fork of jStorage [6k].
    • Tested: 0.1.3
  1. Data Layer Helper - access "dataLayer" properties [2k].
  2. JSON2 - old browser JSON methods (if you care) [3k].

(Sizes are minified, pre-gzipped.)

Example Installation

Include the dependencies on your pages, add groucho configs if you want to deviate from defaults, and output your data layer attributes. Your HTML should look a bit like this...

<script src="jquery.min.js"></script>
<script src="json2.min.js"></script>
<script src="jstorage.min.js"></script>
<script src="data-layer-helper.js"></script>
<script src="groucho.min.js"></script>
<script>
  dataLayer = [{
    'pageId' : 123,
    'title' : 'My Cool Page',
    'type' : 'article',
    'tags' : {
      'my_category' : {
        '123' : 'My Term',
        '456' : 'My Other Term'
      },
      'my_types' : {
        '555' : 'My Type',
        '222' : 'Another Type'
      }
    },
    'myProperty' : 'my value'
  }];
</script>
<script>
  var groucho = window.groucho || {};
  groucho.config = {
    'taxonomyProperty': 'tags',
    'trackExtent': 50,
    'favThreshold': 1,
    'trackProperties': ['type', 'tags'],
    'ttl': 0
  };
</script>

Examples

Favorites

React to your visitors' favorite tags/terms.

var taxonomy = 'my_category',
    myFavs = groucho.getFavoriteTerms(taxonomy);

if (myFavs.length > 0) {
  // Pre-fill any marked form elements and the right taxonomy.
  $('input.pre-fill.' + taxonomy).each(function() {
    $(this).val(myFavs[0].name);
  });
}

Results can include multiple terms if their hit counts are equal. Examples just use the first.

Generate all favorites once, then use results several times on the page.

groucho.getFavoriteTerms();
var taxonomy = 'my_category';

if (groucho.favoriteTerms.hasOwnProperty(taxonomy)) {
  // Prune a list to personalize.
  $('ul.peronalized li').each(function() {
    // Data attribute does not match user's favorite.
    if ($(this).data(taxonomy) !== groucho.favoriteTerms[taxonomy][0].id) {
      $(this).addClass('hide');
    }
  });

  // Set an AJAX form filter automatically.
  $('form.personalize select.' + taxonomy).val(
    groucho.favoriteTerms[taxonomy][0].name
  );
  $('form.personalize').submit();
}

Pageview Tracking

Use page view activity tracking to dig through history and alter UX.

var history = groucho.getActivities('browsing'),
    links = $('a.promoted'),
    count = 0;
for (var i in history) {
  // Determine if they've seen a page with a specific property.
  if (history[i].hasOwnProperty('myProperty') count++;
}
// Visually weight content via past behavior.
if (count < 2) links.addClass('featured');
else if (count >= 2 && count < 7) links.addClass('reduced');
else links.addClass('hidden');

Show the last viewed item of a given type. Example is last watched video...

var history = groucho.getActivities('watch');
if (history.length) {
  $.get("videos.json?id=" + history[0].videoId, function(data) {
    $('.recent').html(displayVideo(data));
  });
}

Custom Activities

Register your own tracking activities like this...

// Track your own activities.
$('.my-special-links').bind('click', function (e) {
  groucho.createActivity('my_activity', {
    'linkText' : $(this).text(),
    'myProperty' : $(this).attr('data-property')
  });
});
// Later...
myActivities = groucho.getActivities('my_activity');

Basic User Info

Wait for data availability and user basic user info.

(function ($) {
  $(document).ready(function(){
    groucho.userDeferred = groucho.userDeferred || $.Deferred();
    groucho.userDeferred.done(function () {
      // Act on a specific user property.
      var origin = $.jStorage.get('user.origin');
      adjustSomething(origin.url);
    }
 });
})(jQuery);

Previous examples simplified.

Tasty bite? Try the full docs.

Tests

This library uses QUnit via Phantom for unit testing via Grunt and Istambul for code coverage analysis.

Thanks.

If you've read this far you might have some suggestions. Feel free to send those or make a merge request. Find something wrong with these docs? Please send that along as well. Why groucho? ...because we can tell who you are with those silly glasses on.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].