Coder Social home page Coder Social logo

keen / keen-js Goto Github PK

View Code? Open in Web Editor NEW
580.0 58.0 145.0 8.59 MB

https://keen.io/ JavaScript SDKs. Track users and visualise the results. Demo http://keen.github.io/keen-dataviz.js/

License: MIT License

keen-io analytics web-analytics customer-insights keen-js native-analytics visualization dataviz dashboards charts

keen-js's Introduction

Keen JavaScript SDK

Get API Keys

If you haven’t done so already, login to Keen to create a project. The Project ID and API Keys are available on the Access page of the Project Console.

Keen Tracking JS

A JavaScript tracking library for Keen. Track events, user actions, clicks, pageviews, conversions and more!

https://github.com/keen/keen-tracking.js

Keen Analysis JS

A JavaScript client for Keen. Make queries with ease!

https://github.com/keen/keen-analysis.js

Keen Dataviz JS

A JavaScript data visualization library for Keen. Create amazing interactive charts!

https://github.com/keen/keen-dataviz.js

Keen Explorer JS

https://github.com/keen/explorer


Keen-js deprecated versions

Previous versions and their documentation are available as branches of this repo.


Support

Need a hand with something? Shoot us an email at [email protected]. We're always happy to help, or just hear what you're building! Here are a few other resources worth checking out:

keen-js's People

Contributors

adamkasprowicz avatar dustinlarimer avatar kylehotchkiss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

keen-js's Issues

Tracking only code

Hello,

In the interest of size, we've hacked together a minimal 'tracking only' library, which is pretty much just the src/intro.js and src/track.js files, then wrapped it up in a local scope for our widget.

Would it be possible for you guys to add this in a more supported way? We're not so keen on adding 30KB of JS when we only use 5 of it!

client.draw() with a JSON object returns error

client.draw(this.data, document.getElementById("averageSpellsPerPlayer"), {
    chartOptions: {
        title: "Average Spells Per Player"
    }
});

[Keen IO] Error: Query 1 of 1 for project 530a932c36bf5a2d23000000 is not a valid request keen-3.0.0.visualize.js:836
[Keen IO] Check out our JavaScript SDK Usage Guide for Data Analysis: keen-3.0.0.visualize.js:836
[Keen IO] https://keen.io/docs/clients/javascript/usage-guide/#analyze-and-visualize keen-3.0.0.visualize.js:836

Spinner for wait time

Need a default spinner + hook to add custom one while waiting for queries to run/charts to load.

Allow custom formatting of metrics

You can't current modify a metric to add something like a '$' in front, or format the number to have commas, control the number of decimal places, etc. If you try to modify this.data.result before calling draw to turn the value into a string, you get the error message "The library you selected does not support this chartType"

It would be nice to basically give users the ability to specify their own "prettyPrint" function. So that they can output a custom formatted value.

Improve error handling

Convert error views into a chart type and pass API responses in as text. This will resolve issues like #78.

Can't draw a table with no config

This may not work at all, but definitely with no config

var recentSpellCasts = new Keen.Query("extraction", {
eventCollection: "spell_casts",
timeframe: "this_7_days",
latest: 10,
property_names: ["spell.name", "player.name"]
});
client.draw(recentSpellCasts, document.getElementById("recentSpellCasts"), {
chartOptions: {}
});

Row order in data table has weird swap of the second and the middle row.

You should see:
image

Notice that row 2 is in row 6's position, and row 6 has pushed row 1 into row 2's position.

If you load this html in your browser:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="https://d26b395fwzu5fz.cloudfront.net/3.0.0/keen.min.js"></script>
</head>
<body id="chart">
   <script type="text/javascript">
            var rows = [];
            var max = 11;
            for ( var i = 1; i <= max; i++) {
               rows.push({
                  col1 : i,
                  col2 : Math.floor(max / 2) - i
               });
            }
            Keen.ready(function() {
               window.chart = new Keen.Visualization({
                  result : rows
               }, document.getElementById('chart'), {
                  chartType : 'datatable',
                  title : "test table",
                  width : "auto"
               });
            });
         </script>
</body>
</html>

Unknown Header Type

You need to wrap the types passed through as headers to the Visualization API.

Uncaught Error: Unknown header type: false 

Limited colorset in the library

The new library has a limited colorset which makes pie charts quite confusing.
See screenshot from workbench (3 of the pie slices are the same color :-p)

screen shot 2014-06-23 at 11 40 55 pm

Enable Set and Refresh on Keen.

As per the example I do this:

var client = new Keen({
    projectId: projectId,
    readKey: readKey
});

Would be handy if I could set these and refresh the project settings. We have a Live/Test projects to separate data.

Something like this:

var client = new Keen({
    projectId: projectId,
    readKey: readKey
});
//--- Change url--
{
  client.set({projectId: otherProjectId, readKey: otherReadKey});
  client.refresh();
}

It's just a suggestion, I'm sure there is a more logical API implementation.

keen.js breaks in IE11

Reproducible in workbench:

File: keen.js, Line: 73, Column: 4
Unable to get property '1' of undefined or null reference

colors option does not work for metric

When colors = ["green"] is added to the display options of a Metric object, this colour is overriden by the default (at some point during drawing, the option colour is displayed, but after the final rendering, the default color ("#00afd7") is used.
When settings colors to at least 3 colors,fe. ["green","red","blue"], the second is used as the color of all objects of the Metric type, not just the one of which the colors option was specified.

this.draw with two series as this.data errors

I thought this was supposed to draw a double line chart?

var averageSpellsPerPlayer = client.run([uniquePlayersPerDay, spellsCastPerDay]);
averageSpellsPerPlayer.on("complete", function(){
    this.draw(document.getElementById("comboDiv"));
});

Data column(s) for axis #0 cannot be of type string

Jordan is getting this strange error in the workbench: "Data column(s) for axis #0 cannot be of type string"

Here's the setup: http://cl.ly/image/220b0h382V3R

Dustin said:
Jordan, it looks like we had an outdated copy of the JS lib cached. I just pushed an update that resolves the issue, so give it a quick refresh and let me know if it's working correctly. Sorry for the inconvenience!

Jordan said:

Interesting. Now the workbench is fine, but my CDN-loaded copy in my app is bad. :^[ http://cl.ly/image/421Q1h1V0J1s

I'm running a Maximum with these options:

{"eventCollection":"monthy_active_engaged_users","groupBy":"line_name","interval":"daily","targetProperty":"value","timeframe":"this_28_days"}

I've also tried copying the javascript source into my env, and running exactly what the workbench tells me -- no luck.

Same data same config, different result.

What else could it be, besides the library, somehow?

This conversation is happen in the google-devs group.

Note: Michelle also had issues with the library versioning which made it impossible to render certain charts, seemingly randomly.

Correct. My env is making this request:

https://api.keen.io/3.0/projects/53641ab9ce5e435d27000005/queries/maximum?api_key=key&event_collection=monthy_active_engaged_users&group_by=line_name&interval=daily&target_property=value&timeframe=this_28_days&timezone=-25200

And produces a chart like:

http://cl.ly/image/1D1W2G2f052Z

No errors in the console.

Keen.Metric options

Expand configuration options for Keen.Metric. This will resolve #76 and #72.

  • configurable prettyNumber method
  • prefix and suffix
{
  chartOptions: {
    decimals: 3,
    prefix: "$",
    suffix: "/mo"
  }
}

client.draw can't take in a JSON object as data

    var averageSpellsPerPlayer = client.run([uniquePlayersPerDay, spellsCastPerDay]);
    averageSpellsPerPlayer.on("complete", function(){
      var newData = [];
      for(var i = 0; i < this.data[0]["result"].length; i++){
        newData.push({
          timeframe: this.data[0]["result"][i]["timeframe"],
          value: this.data[1]["result"][i]["value"] / this.data[0]["result"][i]["value"] 
        })
      }

      this.data = {result: newData};

      client.draw(this.data, document.getElementById("averageSpellsPerPlayer"), {
        chartOptions: {
          title: "Average Spells Per Player"
        }
      });
    })

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.