{"action":"created","issue":{"url":"https://api.github.com/repos/lektor/lektor/issues/503","repository_url":"https://api.github.com/repos/lektor/lektor","labels_url":"https://api.github.com/repos/lektor/lektor/issues/503/labels{/name}","comments_url":"https://api.github.com/repos/lektor/lektor/issues/503/comments","events_url":"https://api.github.com/repos/lektor/lektor/issues/503/events","html_url":"https://github.com/lektor/lektor/issues/503","id":300598219,"number":503,"title":"How to include Google Analytics code only when deploying?","user":{"login":"vitorbaptista","id":76945,"avatar_url":"https://avatars1.githubusercontent.com/u/76945?v=4","gravatar_id":"","url":"https://api.github.com/users/vitorbaptista","html_url":"https://github.com/vitorbaptista","followers_url":"https://api.github.com/users/vitorbaptista/followers","following_url":"https://api.github.com/users/vitorbaptista/following{/other_user}","gists_url":"https://api.github.com/users/vitorbaptista/gists{/gist_id}","starred_url":"https://api.github.com/users/vitorbaptista/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitorbaptista/subscriptions","organizations_url":"https://api.github.com/users/vitorbaptista/orgs","repos_url":"https://api.github.com/users/vitorbaptista/repos","events_url":"https://api.github.com/users/vitorbaptista/events{/privacy}","received_events_url":"https://api.github.com/users/vitorbaptista/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-27T11:45:05Z","updated_at":"2018-02-27T14:22:04Z","closed_at":null,"author_association":"NONE","body":"I've set up Google Analytics using a data bag to hold the tracking ID, and a snippet to include in my templates. My problem is: I don't want Google Analytics enabled on development, only when the site is deployed. I looked for a way to detect if Lektor is building or deploying the project, but couldn't find any. Is there a way to do this?"},"comment":{"url":"https://api.github.com/repos/lektor/lektor/issues/comments/368893524","html_url":"https://github.com/lektor/lektor/issues/503#issuecomment-368893524","issue_url":"https://api.github.com/repos/lektor/lektor/issues/503","id":368893524,"user":{"login":"goanpeca","id":3627835,"avatar_url":"https://avatars3.githubusercontent.com/u/3627835?v=4","gravatar_id":"","url":"https://api.github.com/users/goanpeca","html_url":"https://github.com/goanpeca","followers_url":"https://api.github.com/users/goanpeca/followers","following_url":"https://api.github.com/users/goanpeca/following{/other_user}","gists_url":"https://api.github.com/users/goanpeca/gists{/gist_id}","starred_url":"https://api.github.com/users/goanpeca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goanpeca/subscriptions","organizations_url":"https://api.github.com/users/goanpeca/orgs","repos_url":"https://api.github.com/users/goanpeca/repos","events_url":"https://api.github.com/users/goanpeca/events{/privacy}","received_events_url":"https://api.github.com/users/goanpeca/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T14:22:04Z","updated_at":"2018-02-27T14:22:04Z","author_association":"MEMBER","body":"@vitorbaptista you could perhaps use the extra flag CLI option, then you could use a custom plugin to either pop the GA code or not based on that flag so that it is only taken into account when you passed the flag on deploy?\r\n\r\n```\r\nlektor deploy --help\r\n```\r\n\r\n\r\n```\r\nlektor deploy --extra-flag is_deploy\r\n```\r\n\r\nor\r\n\r\n```\r\nlektor deploy -f is_deploy\r\n```\r\n\r\n```\r\n  -f, --extra-flag TEXT   Defines an arbitrary flag.  These can be used by\r\n                          plugins to customize the build and deploy process.\r\n                          More information can be found in the documentation\r\n                          of affected plugins.\r\n```\r\n"}}
{"actor":{"display_login":"goanpeca"}}