Code Monkey home page Code Monkey logo

middleman-google-analytics's Introduction

Hi, I'm Daniel ๐Ÿ‘‹

GitHub Stats

Daniel Bayerlein's DEV Profile โ€‰

middleman-google-analytics's People

Contributors

adarsh avatar danielbayerlein avatar kpricorn avatar mrjoy avatar ngs avatar outlyer avatar remino avatar tmaier 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

Watchers

 avatar  avatar  avatar  avatar

middleman-google-analytics's Issues

Minified version for build?

It would be great if in the build environment, google_analytics_tag outputted a minified version of the script instead.

If you can point me in the right direction, I'd be happy to put together a PR.

~ Jonathan

Incompatible version for uglifier with newest middleman

Currently I can't use this gem with the newest middleman:

Bundler could not find compatible versions for gem "uglifier":
  In Gemfile:
    middleman (>= 4.1.7, ~> 4.1) was resolved to 4.1.7, which depends on
      middleman-core (= 4.1.7) was resolved to 4.1.7, which depends on
        uglifier (~> 3.0)

    middleman-google-analytics (~> 2.1) was resolved to 2.1.0, which depends on
      uglifier (~> 2.6)

I guess that fix should not be a problem. Thanks.

Releasing new gem versions

@danielbayerlein,

I noticed that I'm still an owner for this on RubyGems -- and that there hasn't been a release in a while. Did I muck something up and not properly transfer ownership to you?

Multiple tracking ids

From what I understand, this is not intended.

In my case my customer and I both have an id because they want to track their page via their account and we track it for verification and convenience that everything is working.

Or is there some other intended way? If not, I could make a Pull Request unless you want to do the changes yourself.

Activesupport version too low for middleman version 4.4.2

Bundler could not find compatible versions for gem "activesupport":
In snapshot (Gemfile.lock):
activesupport (>= 6.1.4.6)

In Gemfile:
middleman (~> 4.4.2) was resolved to 4.4.2, which depends on
middleman-core (= 4.4.2) was resolved to 4.4.2, which depends on
activesupport (>= 6.1, < 7.0)

middleman-google-analytics (~> 3.0) was resolved to 3.0.0, which depends on
  activesupport (>= 4.1, < 5.1)

Running bundle update will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

Please upgrade the activesupport version.

Don't raise an error when property ID is nil in development

I configured google analytics the following way:

activate :google_analytics do |ga|
  ga.tracking_id = ENV['GOOGLE_ANALYTICS_ID']
  ga.anonymize_ip = true
  ga.debug = false
  ga.development = false
  ga.minify = true
end

ENV['GOOGLE_ANALYTICS_ID'] is nil in development.

I get the following error message in development mode

Google Analytics: Please specify a property ID
/usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-google-analytics-1.0.2/lib/middleman-google-analytics/extension.rb:23:in `after_configuration': No property ID given (RuntimeError)
    from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.3.3/lib/middleman-core/extension.rb:130:in `block in bind_after_configuration'

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Adding options for pageview

Hey, I see that the template hardcoded the page tracking options.

I also noticed an older PR that attempted to add an option to disable page tracking, but there hasn't been much movement on that.

I would like to expand on this and add additional options to configure page tracking so that we can specify any of these fields: ga('send', 'pageview', [page], [fieldsObject]);.

I was curious if you think there would be value to this before I work it and submit a PR for it.

Send pageview hit as configuration option

Hey there!

Does it make sense to add the ability to disable the "send" command?

For example:

# config.rb
activate :google_analytics do |ga|
  ...
  # Send pageview hit by default
  ga.send_pageview = true
  ...
end
<%
  # analytics.js.erb
  ...
  ga << "ga('send', 'pageview');" if @options.send_pageview
%>
...

The reason is: AngularJS + Angular UI Router. I want to capture each state in the user flow.

Full article: http://www.arnaldocapo.com/blog/post/google-analytics-and-angularjs-with-ui-router/72

Syntax error / Missing method related to options.debug

Based on the last commit b9ffa62

The Syntax error

options.debug ||= not build?

https://github.com/MrJoy/middleman-google-analytics/blob/master/lib/middleman-google-analytics/extension.rb#L22

$ ruby -c extension.rb
extension.rb:22: syntax error, unexpected tFID, expecting '('

I would suggest to change this line to

options.debug ||= (not build?)

Missing method

After fixing this and running bundle exec rake server I get the following error message

NoMethodError at /
undefined method `debug' for #<Middleman::GoogleAnalytics::Options:0x007fce46c7a198>

Ruby    /usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/bundler/gems/middleman-google-analytics-b9ffa62f98bc/lib/middleman-google-analytics/extension.rb: in google_analytics_tag, line 22
Web GET 0.0.0.0

The related method options returns a hash. Use hash accessors

Javascript via Inclusion?

Seems like it would be nice to have the option of including rather than embedding the javascript for analytics. The current method is presumably faster on rendering, but takes more disk space and bandwidth (can't be cached and referred to by each page).

undefined method `development?' for nil:NilClass

When building my site I'm getting this error:

== Request: /page/2/index.html
       error  build/page/2/index.html
undefined method `development?' for nil:NilClass
/Users/david/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-google-analytics-2.0.0/lib/middleman-google-analytics/helpers.rb:46:in `legacy_development?'
/Users/david/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-google-analytics-2.0.0/lib/middleman-google-analytics/helpers.rb:22:in `render_script'
/Users/david/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-google-analytics-2.0.0/lib/middleman-google-analytics/helpers.rb:14:in `google_analytics_universal_tag'

It seems to be this method:

# Support for Middleman >= 3.4
def legacy_development?
  try(:development?) || try(:app).development?
end

Replace analytics.js with gtag.js

Google is now recommending that all new sites adopt the gtag.js script instead of analytics.js.

gtag.js is the web tagging library that works for Google's site measurement, conversion tracking, and remarketing products โ€“ giving you better control while making implementation easier. By using gtag.js, you will be able to benefit from the latest dynamic features and integrations as they become available.

The gtag.js script merges the functionality of Google Tag Manager and Google Analytics into one and fixes some cross domain cookie issues, as far as I understand it.

This issue is to request for this extension to use gtag.js instead of analytics.js, or offer an option to enable it.

For details, see:

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.