kissmetrics / kissmetrics Goto Github PK
View Code? Open in Web Editor NEWKISSmetrics API - PHP, Python
Home Page: http://www.kissmetrics.com
License: Apache License 2.0
KISSmetrics API - PHP, Python
Home Page: http://www.kissmetrics.com
License: Apache License 2.0
** This repository is now deprecated, please see https://github.com/kissmetrics/KISSmetrics/releases/tag/v1.0.0 for the final versions of all included clients ** KISSmetrics is different from other analytics platforms due to a combination of three key features. We focus on funnels and conversions and make them easy to track and interpret, use people as the basic unit of measure, and support tracking of highly-flexible custom data through our simple API. Find out more at http://www.kissmetrics.com * ruby client has moved to https://github.com/kissmetrics/km * php client has moved to https://github.com/kissmetrics/kissmetrics-php * python client has moved to https://github.com/kissmetrics/py-KISSmetrics * perl client is complete with crontab option (untested)
FYI for anyone who needs to use km.py on Google App Engine.
The problem is that km.py uses the socket package, whereas Google App Engine locks down arbitrary socket connections. Instead, you can make a connection over port 80 via urlfetch. Here's the changes you need to make.
Remove the "import socket" line from the top and replace it with "from google.appengine.api import urlfetch"
After "host,port = cls._host.split(':')", replace the socket logic with the following:
if int(port) == 80:
url = 'http://' + host + '/' + type + '?' + '&'.join(query)
urlfetch.fetch(url)
else:
raise Exception("Can only connect over port 80.")
Hope this helps someone. Email me with any questions: [email protected]
The options array passed to the init function will not work properly when the option has a boolean value and that value is FALSE because in array_get function the default value is used when the empty function returns true for the option array value.
To reproduce:
Just add 'to_stderr' => FALSE to your options array and you will see the to_stderr setting stays set to the default of TRUE.
For usage in composer/packagist/satis it would be great if you could tag the repo. Otherwise one needs to use minimum-stability: dev
to be able to install this (in a project using a library depending on this software) :(
How about adding a tag v0.1.0
- packagist should pick it up automatically!
It'd sure be nice to just be able to go: pip install kissmetrics :)
urllib.urlencode encodes spaces as '+' instead of '%20'. urllib.quote should be used instead. Data with spaces shows up with '+' on the backend
Firstly, thanks very much for providing this project!
Having said that, I've never seen this sort of mixing of client libs into one repo. I would not assume it to be a very good practice, particularly if someone is hoping to version and manage a lib based on semantic versioning, or is hoping to help move a project in that direction.
Can we please separate these out please? Would love to help the official libraries become first class examples of how to write a client api lib :)
I could do the work and transfer ownership of the resulting repos to your account, if you would agree to maintain them as the official offerings.
It would be awesome if you'd publish the Kiss Metrics package to PyPi so that it's easier to include the dependency in setup.py.
Tagging a release would be a good first step, at which point I can include this in setup.py:
dependency_links=[
'https://github.com/bcoe/KISSmetrics/tarball/v0.1.0#egg=KISSmetrics'
]
I'm a bit concerned by the lack of thread safety in the Python module - since it's using class methods and variables, it's possible in a threaded environment that the wrong methods will be caused in the wrong order (so a record could be saved against the wrong identity).
I've rewritten the module to be threadsafe - here's my branch: https://github.com/simonw/KISSmetrics/blob/master/km.py
The windows version of python doesn't support the %s format string for the strftime.
I think that the usage of raw sockets for performing an HTTP Request to KISSmetrics should probably be replaced with httplib. urllib can also be used for setting the get string parameters, rather than iteration.
If you call the Kissmetrics python code with a unicode string it blows up because it uses str()
to construct a url:
File "/hats/src/kissmetrics/KISSmetrics/__init__.py", line 28, in record
self.request('e', props)
File "/hats-0.19.0/hats/src/kissmetrics/KISSmetrics/__init__.py", line 87, in request
query.append(urllib.quote(str(key)) + '=' + urllib.quote(str(val)))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
I am trying to send the username and it doesn't work if the user is using unicode. You guys do support unicode in the url right?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.