parsely

Wrapper for Parsely's data insertion API

node-parsely

A javascript client for the Parse.ly APIs.

npm install parsely

This is a very light wrapper around the parsely.com API, providing the same options as the API docs there. The wiki has a full set of API docs, where you can see what method corresponds to which API, and a list of the parameters they take.

 
var parsely = require('parsley');
 
var trackingData = {
  idsite: 'parselyid',
  date: (new Date()),
  data: {
    parsely_site_uuid: 'unique id for client'
  }
};
 
parsely.track(trackingData, 'Mozilla/6.0', function(err){
  if(err){
    console.log(err);
  }
});
parsely.analytics.byType('query', 'posts', {days: 1}, {sharedSecret: 'dudes'}, function(errdata){
  if(err){
    console.log(err);
  }
  console.log(data);
});
git clone https://github.com/toddself/node-parsely
cd node-parsely
npm install

Returns a list of posts, authors, section topics or tags depending on specified type. Docs: analytics/{type}

Name Type Argument Description
type string

One of posts, authors, sections, topics, tags

opts object <optional>

A list of options for the call

Name Type Argument Description
days string <optional>

Number of days since today to consider for _hits value. Defaults to 3.

period_start mixed <optional>

Period of data to cover. Must supply opts.period_end as well

period_end mixed <optional>

Period of data to cover, cannot be in the future. Must use opts.period_start as well.

pub_date_state mixed <optional>

Start date of content publication to consider. Must use opts.pub_date_end as well.

pub_date_end mixed <optional>

End date of content publication to consider. Must use opts.pub_date_start as well.

sort string <optional>

Sort value. Defaults to _hits

limit string <optional>

Number of records to retrieve, detauls to 10

page string <optional>

Page number of results set, defaults to 1

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do when it's done!

Source:

undefined

Type object

Returns a list of posts falling under the specified author, section or topic. Docs: /analaytics/{meta}/{value}/detail

Name Type Argument Description
meta string

What values to return. Must be one of author, section, topic, tag

value string

Search term for query

opts object <optional>

A list of options for the call

Name Type Argument Description
days string <optional>

Number of days since today to consider for _hits value. Defaults to 3.

period_start mixed <optional>

Period of data to cover. Must supply opts.period_end as well

period_end mixed <optional>

Period of data to cover, cannot be in the future. Must use opts.period_start as well.

pub_date_state mixed <optional>

Start date of content publication to consider. Must use opts.pub_date_end as well.

pub_date_end mixed <optional>

End date of content publication to consider. Must use opts.pub_date_start as well.

sort string <optional>

Sort value. Defaults to _hits

limit string <optional>

Number of records to retrieve, detauls to 10

page string <optional>

Page number of results set, defaults to 1

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret* @param {Function} cb [description]

Source:

undefined

Type object

Returns the metadata and total pageviews for a post specified by URL. Docs: /analytics/post/detail

Name Type Argument Description
url string

Canonical URL for asset. Must start with http/s

opts object <optional>

A list of options for the call

Name Type Argument Description
days string <optional>

Number of days since today to consider for _hits value. Defaults to 3.

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do when it's done

Source:

undefined

Type object

Retrieve a list of URLs and the corresponding clicks recorded by the API over a period. Docs: /clicks

Name Type Argument Description
apikey string

The publisher API key

opts object <optional>

A list of options for the call

Name Type Argument Description
url string <optional>

Restrict the listing to a specified URL

days string <optional>

Number of days since today to consider for _hits value. Defaults to 3.

period_start mixed <optional>

Period of data to cover. Must supply opts.period_end as well

period_end mixed <optional>

Period of data to cover, cannot be in the future. Must use opts.period_start as well.

limit string <optional>

Number of records to retrieve, detauls to 10

page string <optional>

Page number of results set, defaults to 1

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do when it's done!

Source:

undefined

Type object

Retrieve a list of URLs and the corresponding clicks recorded by the API over a period. Docs: /clicks

Name Type Argument Description
apikey string

The publisher API key

opts object <optional>

A list of options for the call

Name Type Argument Description
days string <optional>

Number of days since today to consider for _hits value. Defaults to 3.

period_start mixed <optional>

Period of data to cover. Must supply opts.period_end as well

period_end mixed <optional>

Period of data to cover, cannot be in the future. Must use opts.period_start as well.

limit string <optional>

Number of records to retrieve, detauls to 10

page string <optional>

Page number of results set, defaults to 1

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do when it's done!

Source:

undefined

Type object

Specify posts to be ranked in the recommendation API. Docs: /editorial_override

Name Type Argument Description
url string

URL of the article to re-rank

expiry mixed <optional>

Date, in YYYY-MM-DD to expire ranking (max: 2 weeks)

priority number

The priority you want. 1 is highest...

apikey string

Your publisher API key

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do when it's done!

Source:

undefined

Type object

Retrieve list of URLs that should be given special ranking. Docs: /editoral_overrides

Name Type Argument Description
limit number <optional>

Number of records to retrieve, defaults to 10

page number <optional>

Page to request

apikey string

publisher's api key

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do when it's done!

Source:

undefined

Type object

Retrieve a list of URLs visited by a user by UUID. Docs: /history. THIS METHOD'S SIGNATURE DIFFERS FROM THE DOCS SINCE THEY ARE CALLING A UUID DAYS

Name Type Argument Description
uuid string

UUID of person to get history

apikey string

The publisher API key

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do when it's done!

Source:

undefined

Type object

Train a user profile for the purpose of personalized recommendations. Docs: /profile

Name Type Argument Description
uuid string

UUID for the user profile being trained

url url

The URL being trained against the profile

apikey string

Publisher API key

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do with the results

Source:

undefined

Type object

Retrieve a list of post recommendations which are either personalized or for a specific URL. Docs: /related

Name Type Argument Description
type string

Recommend by uuid or url

criteria string

Either the UUID or URL to retrieve recommendations for

apikey string

The publisher API key

opts object <optional>

A list of options for the call

Name Type Argument Description
days string <optional>

Number of days since today to consider for _hits value. Defaults to 3.

pub_date_state mixed <optional>

Start date of content publication to consider. Must use opts.pub_date_end as well.

pub_date_end mixed <optional>

End date of content publication to consider. Must use opts.pub_date_start as well.

limit string <optional>

Number of records to retrieve, detauls to 10

page string <optional>

Page number of results set, defaults to 1

section string <optional>

Return recommendations that belong only in the specified section

author string <optional>

Return recommendations that belong only to the specified author

tag string <optional>

Return recommendations that belong only to the specified tag

strategy string <optional>

Algorithm to use for search. One of click or recency. Defaults to recency

clickMethod string <optional>

What click method to use for when opts.strategy is click. One of ref_social, ref_search, ref_internal

sort string <optional>

What to sort the results by. There are currently 2 valid options: score, which will sort articles by overall score and pub_date which will sort results by their publication date. The default is score.

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do when it's done!

Source:

undefined

Type object

Return a list of top referrers by type. Docs: /referrers/{type}

Name Type Argument Description
type string

One of social, search, other, internal

apikey string

Your parsley API key

opts object <optional>

Options for the call.

Name Type Argument Description
section string <optional>

Section to restrict this query to.

tag string <optional>

Tag to restrict this query to.

domain string <optional>

domain to restrict this query to.

days number <optional>

Number of days since today to consider; defaults to 3 days. Use days=14 or days=30 to only consider traffic from last several days.

period_start mixed <optional>

Period of data to cover. Must be specified with period_end.

period_end mixed <optional>

Period of data to cover; must be specified with period_start, must be greater than that value, and must not be in the future.

pub_date_start mixed <optional>

Publication date. Must be specified with pub_date_end.

pub_date_end mixed <optional>

Publication end date; must be specified with pub_date_start, must be greater than that value, and must not be in the future.

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do with the results

Source:

undefined

Type object

Return a list of the top posts, authors, sections or topics referred to. Docs: /referrers/{referrer_type}/{meta_type}

Name Type Argument Description
type string

One of social, search, other, internal

meta string

One of posts, authors, sections,topics, tags

apikey string

Your parsley API key

opts object <optional>

Options for the call.

Name Type Argument Description
section string <optional>

Section to restrict this query to.

tag string <optional>

Tag to restrict this query to.

domain string <optional>

domain to restrict this query to.

days number <optional>

Number of days since today to consider; defaults to 3 days. Use days=14 or days=30 to only consider traffic from last several days.

period_start mixed <optional>

Period of data to cover. Must be specified with period_end.

period_end mixed <optional>

Period of data to cover; must be specified with period_start, must be greater than that value, and must not be in the future.

pub_date_start mixed <optional>

Publication date. Must be specified with pub_date_end.

pub_date_end mixed <optional>

Publication end date; must be specified with pub_date_start, must be greater than that value, and must not be in the future.

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret

cb function

What to do with the results

Source:

undefined

Type object

Returns a list of posts falling under the specified author, section or topic. Docs: /referrers/{referrer_type}/{meta_type}/{meta_value}/detail

Name Type Argument Description
type string

One of social, search, other, internal

meta string

One of posts, authors, sections,topics, tags

value string

The value for this meta type

apikey string

Your parsley API key

opts object <optional>

Options for the call.

Name Type Argument Description
tag string <optional>

Tag to restrict this query to.

domain string <optional>

domain to restrict this query to.

days number <optional>

Number of days since today to consider; defaults to 3 days. Use days=14 or days=30 to only consider traffic from last several days.

period_start mixed <optional>

Period of data to cover. Must be specified with period_end.

period_end mixed <optional>

Period of data to cover; must be specified with period_start, must be greater than that value, and must not be in the future.

pub_date_start mixed <optional>

Publication date. Must be specified with pub_date_end.

pub_date_end mixed <optional>

Publication end date; must be specified with pub_date_start, must be greater than that value, and must not be in the future.

auth object <optional>

Authorization information. If not using, pass in null or undefined

Name Type Argument Description
secretKey string <optional>

If using oAuth your app's secret. Must be used with auth.consumerKey

consumerKey string <optional>

If using oAuth, your app's consumer key. Must be used with auth.secretKey

sharedSecret string <optional>

If using shared secrets, your shared secret