Giter VIP home page Giter VIP logo

honeycomb's Introduction

##Honeycomb

Paste the following snippet into your javascript file to set up tracking for your website. Alternatively, nest it between <script> tags </script>, and paste it right before the closing </body> tag of any pages you want to track.

“‘ <script> var unique_key = <insert unique key here> var endpoint = “localhost:3000/api/v1/events

var honeycomb = function(event_name, label, value) {

var honey_event = {
  'event':
  {
    name: event_name,
    property_1: label,
    property_2: value,
    url: window.location.href
  },
  unique_key: unique_key
}
var honey_request = new XMLHttpRequest();
    honey_request.open("POST", endpoint, true);
    honey_request.setRequestHeader('Content-Type', 'application/json');
    honey_request.onreadystatechange = function() {

    };
    honey_request.send(JSON.stringify(honey_event));

}; honeycomb(“pageview”); </script> “‘ Make sure you replace “<insert unique key here>” with the one assigned to you when you [sign up](localhost:3000/users/sign_up)!

Also: Paste this snippet directly into an HTML element to track clicks (like in a link, in the example below): “‘ <a href=“#” onClick=“honeycomb(’click’, ‘video’, ‘play’);”>Play Video</a>

“‘ The first parameter (’Click’) refers to the event action or category, and the other two (‘Video’ and ‘Play’) are optional custom properties. Rename these to describe the context/thing being clicked, or whatever makes sense for you.

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.