Webflow sync, pageviews & more.
NEW
Answers

Is there a way to obtain the internal Webflow Page ID and internal Webflow Item ID within a Webflow page or using custom code or HTML embeds?

Webflow does not provide a native way to obtain the internal Page ID or Item ID within a Webflow page or through custom code. However, there are some workarounds you can implement to achieve this.

For the internal Page ID, you can employ JavaScript to retrieve the current page's slug and use that information to identify the page. Here's an example code snippet that can help you accomplish this:

```javascript
var currentUrl = window.location.pathname;
var pageSlug = currentUrl.substring(currentUrl.lastIndexOf('/') + 1);
```

By using the `pageSlug` variable, you can create logic based on specific page slugs within your custom code or HTML embeds.

Regarding the internal Item ID, Webflow does not expose this information directly. The CMS Collection List in Webflow only offers a way to loop through the items of a collection but does not provide the internal IDs for individual items.

To work around this limitation, you can add a custom field to your CMS Collection called "Internal ID" or similar. Then, manually assign a unique identifier for each item in that field. This way, you will have a way to reference the internal ID of a specific item within your custom code or HTML embeds.

Remember that this workaround requires manual management of the internal IDs and updating them if any changes are made to the collection. Also, keep in mind that if you clone or duplicate items, you need to ensure the internal IDs remain unique.

It's important to note that Webflow evolves and updates its features regularly. So, it's worth checking the official Webflow documentation or community forums for any potential updates or new features that might provide a more direct solution for obtaining internal Page ID or Item ID.

Rate this answer

Other Webflow Questions