you can set a Jekyll environment and value, when build time
JEKYLL_ENV=production jekyll b
JEKYLL_ENV=production jekyll build
JEKYLL_ENV=production bundle exec jekyll build
if your code contains the bellow snippet, analytics.html
will not be included unless your building with JEKYLL_ENV=production
{% if jekyll.environment == "production" %} {% include analytics.html %} {% endif %}