Coder Social home page Coder Social logo

hhy5277 / purser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bilbof/purser

0.0 2.0 0.0 8 KB

A lightweight JavaScript library for preserving user data from first website visit to signup.

Home Page: http://purser.herokuapp.com/?utm_source=abc&utm_medium=example

JavaScript 68.92% CSS 1.07% HTML 30.01%

purser's Introduction

Purser

A lightweight JavaScript library for preserving user data from first website visit to signup.

Usage

The library stores data such as utm_medium, landing_page and referrer in a localStorage object, and makes the object available via a handy API with the following methods:

Purser.create() // automatically called on first website visit
Purser.fetch() // returns the object
Purser.convert(obj) // returns the object updated with conversion data
Purser.update(obj) // lets you add additional parameters to the object
Purser.destroy // removes the object from localStorage

View a live example at http://purser.herokuapp.com/.

Installation

git clone https://github.com/bilbof/purser
  1. Add purser.js to every page on your website. When a visitor creates an account, call purser.convert(obj) and add the user to your CRM/ChartMogul with attributes returned.
  2. When a visitor creates an account, call purser.convert(obj) to get the visitor's marketing attributes
  3. Add the user's marketing attributes to them in your CRM or app

Example

See an example at http://github.com/bilbof/purser/example.

Code example

<script src="purser.js"></script>
<script>
  $('.red-signup-button').click(function(){

      var attributes = purser.convert({
        signup_button: "red-signup-button"
      });

      // here send the customer object to your CRM/app with their attributes
  });
</script>

The attributes object in the example above would look something like this:

{
	"first_website_visit": "2017-02-19T17:52:18.088Z",
	"referrer": "www.google.co.uk",
	"browser_timezone": 0,
	"browser_language": "en-GB",
	"landing_page": "http://localhost:5000/product",
	"screen_height": 800,
	"screen_width": 1280,
	"utm_medium": "google_search_ads",
	"utm_source": "google",
	"signup_button": "red-signup-button",
	"converted_at": "2017-02-19T17:52:41.981Z",
	"conversion_page": "http://localhost:5000/signup"
}

purser's People

Contributors

bilbof avatar fredkelly avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.