---
schema_version: "1"
id: b270db45673077473304c3c364ec6927e7b7c6488f6b837830b2763b883820fa
title: Route Change
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/lightning-base-components/lightning-design-system/guides/aura/components/forceCommunity/routeChange/forceCommunity-route-change.md
canonical_url: https://developer.salesforce.com/docs/platform/lightning-component-reference/guide/forceCommunity-route-change.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4b3f46890fb338a4f76b4f0afe6bff02504fc45ab027731293215e0bc2fb5781
products:
  - Lightning Component Reference
---
# Route Change

**`forceCommunity:routeChange`**

Indicates that a page's url is changed.

**For Use In**

Experience Builder Sites

::::::tabset{tabs='["Develop", "Specifications"]'}

:::::tab

`forceCommunity:routeChange` is fired when a page’s URL changes. Custom Lightning components can listen to this system event and handle it as required—for example, for analytics or SEO purposes.

This example listens to the event and updates a counter that denotes the number of times the route has changed.

```xml
<aura:component implements="forceCommunity:availableForAllPageTypes">
    <aura:attribute name="routeChangeCounter" default="0" type="Integer" required="false"/>
    <aura:handler event="forceCommunity:routeChange" action="{!c.handleRouteChange}"/>
    <h1>Route was changed: {!v.routeChangeCounter} times</h1>
</aura:component>
```

This client-side controller updates the counter.

```javascript
handleRouteChange : function(component, event, helper) {
    component.set('v.routeChangeCounter', component.get('v.routeChangeCounter') + 1);
}
```

This event is supported in Aura-based Experience Builder sites only.


:::::

:::::tab

![No specifications to show](https://developer.salesforce.com/media/no-specs.png)


:::::
::::::
