Use github token with my github page

I’m creating a github page and I want that with some user interactions, some info get saved to a github repo. 

To do this, I’m using github api module, but when I submitted the commit with the changes, Github deprecated my token for security reasons. 

I’m ok with that, it totally makes sense. But now, I’m confused. How am I supposed to use an access token in a github pages repo? should I set it as a environment variable and not commit it? but if it is in a github pages repo I have to commit it. Or is there other way??

I’m using browserify and other npm modules with no site generator. Any thanks is appreciated.

1 Like

I can’t think of a way to do this with Github Pages alone.

I am in no way affiliated, but use Netlify to do exactly this (Bonus, it’s free).

Either using Snippet Injection (https://www.netlify.com/docs/inject-analytics-snippets/) if it is pure html/css/js.

Or using Environment Variables that get included in the build process for static site generation (https://www.netlify.com/docs/build-settings/).

1 Like

Thanks for the suggestion, will check it asap.