danielbayerlein / middleman-google-analytics Goto Github PK
View Code? Open in Web Editor NEW๐ A @middleman plugin to handle generating your Google Analytics tracking code.
License: MIT License
๐ A @middleman plugin to handle generating your Google Analytics tracking code.
License: MIT License
when using ga.output = :html it generates type="text/javascript" which is unnecessary.
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
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.
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?
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.
Hi Daniel
When I trying to deploy my website on Netlify, it failed because it could not find 'middleman-google-analytics' in gem source.
Sam
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.
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'
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.
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.
There's an option to anonymize IPs. This is mandatory, someone wants to use Google Analytics in germany.
It would be great if there would be a way to switch this on.
Is there any work being done to support the new analytics.js? Want to make sure I don't migrate over and break the plugin. Thanks!
Google recommends analytics.js for tracking. Any thoughts on upgrading from ga.js?
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
Based on the last commit b9ffa62
options.debug ||= not build?
$ ruby -c extension.rb
extension.rb:22: syntax error, unexpected tFID, expecting '('
I would suggest to change this line to
options.debug ||= (not build?)
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
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).
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
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:
See: https://developers.google.com/analytics/resources/articles/gaTrackingTroubleshooting#gaDebug
Basically logs all GA transitions to the console rather than attempting to send to GA
https://support.google.com/analytics/answer/2558867?hl=en
This doesn't seem to currently be possible with the extension, and should be easy to add; as a configuration option, of course.
At the moment the gem isn't supporting middleman v4 installations.
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.