Sha256: e6bfa19837e26372c800300854247099792a4d0b19324cd6b196dff4233cad69

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 Bytes

Contents

module Analytical
  module Console
    class Api
      include Analytical::Base::Api
      include ActionView::Helpers::JavaScriptHelper

      def initialize(parent, options={})
        super
        @tracking_command_location = :head
      end

      def init_javascript(location)
        return '' unless location==:head
        js = <<-HTML
        <!-- Analytical Init: Console -->
        <script type="text/javascript">
          console.log('Analytical Init: Console');
        </script>
        HTML
        js
      end

      def track(*args)
        "console.log(\"Analytical Track: #{escape_javascript args.to_json}\");"
      end

      def identify(id, *args)
        "console.log(\"Analytical Identify: #{id} #{escape_javascript args.to_json}\");"
      end

      def event(name, *args)
        "console.log(\"Analytical Event: #{name} #{escape_javascript args.to_json}\");"
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
analytical-0.3.0 lib/analytical/console.rb