1.0.6 • Published 8 years ago

node-circulate v1.0.6

Weekly downloads
7
License
Apache-2.0
Repository
github
Last release
8 years ago

Circulate Hashed Data Collection for Node.js

This is a library to aid in the implementation of Circulate hashed data colection. This library hashes data and builds the HTML placement for adding to a webpage or in an email for ad tracking. It also provides convenience for dealing with cookies.

Installation

$ npm install node-circulate

API

getHtml(siteId, userData)

Generates the the Circulate HTML placement. The "email" value should be the hashed email from hashEmail()

@param <number> siteId - site identifying key
@param <object> userDatda - Object representation of user data
@return <String> - email address hashed using Circulate's algorithm

hashEmail(email)

Gets the Circulate email hash string

@param <string> email - email address
@return <string> - email address hashed using Circulate's algorithm

expressSetCookie(response, path, domain)

Convenience method for setting Circulate cookie when using Express framework

@param <object> response - Express Response object
@param <string> path - (Optional) Cookie path
@param <string> domain - (Optional) Cookie domain
@return <undefined>

expressGetCookie(request)

Convenience method for getting Circulate cookie when using Express framework. NOTE: This requires that the cookie-parser middleware be loaded.

@param <object> request - Express Request object
@return <undefined>|<object> - Cookie value if set; undefined otherwise

Example

myExpressController = function(request, response, next) {
  var circulate = require('./index'),
    hashedEmail,
    circulatePlacement;

  // Hash email with Circulate algorithm
  hashedEmail = circulate.hashEmail('fdsafdsaf@gmail.com'),

  // Get HTML placement
  circulatePlacement = circulate.getHtml('site123', {hema: hashedEmail});

  // Add cookie to response
  circulate.expressSetCookie(response);

  // Send the response
  response.render('/myView', {circulatePlacement: circulatePlacement})
}

Disclaimer

NOTE: This is a third-party, open source library developed by Path Evolution, LLC and is not officially supported by Circulate.com, Inc.. This project is licensed under Apache License 2.0.

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago