Heads up! This blog post hasn't been updated in over 2 years. CodePen is an ever changing place, so if this post references features, you're probably better off checking the docs. Get in touch with support if you have further questions.


Filip Kis needed that. I think the idea is that it's a unique identifier, so if you need that for something programmatic (perhaps a unique key for Firebase or something), you got it. It also ensures that forks will also use their own unique key.

Here's the solution:

See the Pen CodePen ID Function by Filip Kis (@filipkis) on CodePen.

Perhaps one day we can start providing data like that in an easier-to-access way, but it bears some consideration. Inserting a global seems a little obtrusive.