Jekyll::Newrelic
Add New Relic Browser to your Jekyll site.
Installation
Add this line to your application's Gemfile:
gem 'jekyll-newrelic'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jekyll-newrelic
Usage
Add the necessary configuration to to _config.yml
. Start by adding jekyll-newrelic
to the list of gems for Jekyll to install:
gems:
- jekyll-newrelic
Next setup your site with New Relic, and add the licenseKey
and applicationID
returned from when you setup Browser site. You can find these values by looking at the very end of the javascript code generated by New Relic. Check the documentation here for more details.
newrelic:
licenseKey: "abcdef1234" # Use the actual licenseKey
applicationID: "12345678" # Use the actual applicationID
Then add the following tag after the following line where you'd like the NewRelic code to be executed. NewRelic recommends including this at the end of the HEAD. Add the following before </head>
in _includes/head.html
{% newrelic %}
If you have multiple environments, you may only want to use New Relic in a specific environments. Here's an example of how to only use New Relic in your production
environment:
{% if jekyll.environment == "production" %}{% newrelic %}{% endif %}
The above example is useful for making sure you don't load the New Relic code when performing local development or in other non-production environments. This can throw your numbers off.
Troubleshooting
If you do not properly configure jekyll-newrelic
and try to build a Jekyll site, you will get the following error message:
Invalid jekyll-newrelic configuration. See https://github.com/brint/jekyll-newrelic#usage for more details on usage and configuration.
Check spelling and capitalization of letters to make sure everything is properly configured.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/brint/jekyll-newrelic. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.