Idea: Store number of remixes in .env

I see the new .env update and it looks great but it would be awesome if you could see how many times your project was remixed in the .env.

I dunno, I recently made a blog template named ez-blog.glitch.me and it would be nice to know when somebody uses it to make their blog.

I think it would be nice if stored in .env so that the number of remixes is private.

Is this a good idea?
Thanks in advance for the feedback,
DerDer56

2 Likes

Hi, I would recommend against storing such information in the .env file.

The purpose of this file is to store environment variables that may or may not be secret properties of your application.

However, I am definitely not against Glitch storing the remix count internally and expose an API endpoint for us users to have access to.

1 Like

Ok, thanks for the feedback!
Maybe some kind of way to store the amount of remixed locally would be nice, though.

Maybe this could be done in a file outside of the editor, maybe on the project page.

It might have been possible for an API endpoint to exist when Team Analytics where a thing. Now that they’ve been deprecated/discontinued, I’m not sure. Maybe poking between pages with DevTools logging for XHR requests might find that endpoint.

Is there any way this could be done, though?

Each container already has PROJECT_REMIX_CHAIN as an environment variable which is a list of project ID’s that make up a project’s ancestry. It’s not the same thing but it’s similar. It’s also not shown in the .env file but it is accessiable from the terminal.

3 Likes

Ooh, thanks! I’ve been looking for POST and GET requests on the number of remixes, but so far I’ve found nothing.

The remix chain isn’t very helpful because it is either one of the following projects or a combination of them:

https://api.glitch.com/v1/projects/by/id?id=b952187a-ea2e-4a1c-9055-f455c996a381
https://api.glitch.com/v1/projects/by/id?id=0a59806f-5c0d-468e-84bb-fa5b54ecf500
https://api.glitch.com/v1/projects/by/id?id=929980a8-32fc-4ae7-a66f-dddb3ae4912c

To get the remix chain of the project using the API, you need to refer to project using its ID.

It could be stored in the App Status area with the cpu usage and such

I don’t think you understand how storage of such information works, what you see in the app status is data collected from another program (containerd or docker I think), storage of remix count would be stored in a database, information is collected from the database and served in an API, the client (end-user, us) will fetch that information and display such information in the proper area.

1 Like

True I see that now lol

Adalytics uses images to count site hits, which get pushed to a dashboard. Perhaps there may be a way to do the same thing with remixing?

Maybe each time the button is pressed, it gets recorded

I thought so too, but no count is being made when the Remix button is clicked. The only requests that are being made is the link to the new project. Once you’re in a new project, another request is made to the project that was remixed to fetch its contents. Maybe for analytics, they might be using a third-party plugin instead of the Glitch API?

Maybe.

It’s hard tracking who remixed your project, but how many remixed should be easy to track

How? Both info would be useful. I don’t think it’s hard, it was used when Team Analytics was existing.

Yeah, I guess it would be pretty hard to use API and third-party tools/software may be pretty inneficient. I still think it would be nice for some form of remix counter.

A lot of interesting values in the API.
permissions
notSafeForKids

Yeah, but nothing interesting for me, like Remix counts.

1 Like

I would almost consider putting up a feature request for that.

There might be more endpoints to the API which might have all these info. Only if they documented the API and officialy released it, now that the ToS contains information regarding the API. Also, some info might need authentication and some might requests like POST and PATCH.

1 Like

@khalby786 perhaps there could be a way… Like remixing through the actual project site sends a request to a dashboard which holds the counter

@random when a project is remixed, two POST requests are made:
https://api.glitch.com/projects/PROJECT_ID/edited
https://api.glitch.com/v1/projects/by/domain/PROJECT_NAME

Maybe we can count how many times the requests are made

How do you that? Considering the fact that Glitch API is not ours…

1 Like

No… But there are packages

What are they? I’m very interested in finding a way to get remixes…

If only Team Analytics still existed.

1 Like

Okay, I’m gonna ask Glitch Staff if an endpoint exists: @glitch_support.

2 Likes

I think @jarvis394 had one…

Would there be a way to manually tell, like some kind of external console.log(window.location.hostname)?

The NPM package doesn’t have it…

There is a env variable for project ids of remixes (if It is useful for at all for you) it is called PROJECT_REMIX_CHAIN which has something like this for example [b952187a-ea2e-4a1c-9055-f455c996a381,0a59806f-5c0d-468e-84bb-fa5b54ecf500,929980a8-32fc-4ae7-a66f-dddb3ae4912c] and is something currently being documentated over here https://github.com/youngchief-btw/Glitch-Docs

1 Like

Thanks for all the info @youngchief!

That’s nice to know, but how would i convert the string into number of remixes?

@youngchief, I don’t think that solves the issue because as @FlantasticDan said, it only shows the projects which make up the current project. And in all cases (except GitHub import projects, I’m not sure) it is one of the three projects or sometimes all three of them, named static-start, hello-express and hello-webpage. See Idea: Store number of remixes in .env and Idea: Store number of remixes in .env

1 Like

I believe you could do something like this, but I haven’t tried it before. I’m just assuming this is how the remix chain works:

let remixes = process.env.PROJECT_REMIX_CHAIN
remixes = remixes.replace("[", "").replace("]", "")
let remixarray = remixes.split(",")
let number = remixarray.length

Or a one-liner function:

const getRemixes = () => (process.env.PROJECT_REMIX_CHAIN || "").match(/[0-9-a-f\-]+/gi) || [];

Usage:

getRemixes()
// [
//   "b952187a-ea2e-4a1c-9055-f455c996a381",
//   "0a59806f-5c0d-468e-84bb-fa5b54ecf500",
//   "929980a8-32fc-4ae7-a66f-dddb3ae4912c"
// ]

I knew that used to be a checkbox! When did they remove it?

1 Like

I’ve been on glitch for 7 months and I can’t remember ever seeing it.

I’ve been on it since October 2019 and haven’t seen it.

Thats when I joined too!

I joined from a coding club. pastoral-panama.glitch.me was my first project

1 Like

I just joined because some friends were using Glitch too.

Thanks, very helpful! :slight_smile:

One of my friends used glitch to make their website so I decided to build a simple html website and here we are.

@RiversideRocks please check your messages on S2SL

I joined to host HTML, originally from thimble

1 Like

Yeah i know right you start with something simple and then ur good at it

1 Like