Skip to main content

The amplitude docs include this note:

Starting from v2.8.0 the SDK supports getting the device ID from the URL paramter ampDeviceId. The SDK configuration, for example, init('API_KEY', { deviceId: 'custom-device-id' }) still takes precedence over the URL parameter. Previous versions of the SDK supported the deviceId URL parameter, this option is still supported for backward compatibility but ampDeviceId will take precedence if both are set. You don't need to change your code if upgrade to versions higher than v2.8.0 but it is recommended.

 

But then later on, there is also mention of the “ampSessionId” while I’m pretty sure the older version was just “sessionId”. Is there a full list somewhere of all the URL parameters that the SDK will attempt to automatically use, along with information about priority (for example I’m assuming ampSessionId would override sessionId) and support/deprecation information?

For example, we do still use `sessionId` in some cases, and I’d like to confirm whether that’s still valid or if we need to switch to the `ampSessionId`.

Hi Robby,

Thank you for reaching out! I understand you're looking for a comprehensive list of URL query parameters that the Browser SDK 2.0 automatically uses, along with details on priority and support/deprecation—specifically regarding the transition from `sessionId` to `ampSessionId`.

The Browser SDK 2.0 automatically tracks several URL query parameters for attribution and session management. `ampSessionId` is the newer parameter introduced for session tracking. It takes precedence over the older `sessionId` parameter if both are present in the URL. `sessionId` is still supported for backward compatibility but is overridden by `ampSessionId` if both are set.

`ampDeviceId` is introduced in SDK version 2.8.0, this parameter is used to set the device ID. It takes precedence over the older `deviceId` parameter. `deviceId` is still supported for backward compatibility but overridden by `ampDeviceId` if both are present.

The SDK captures the five standard UTM parameters: `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, and `utm_content` and these parameters are case-sensitive and are used for marketing attribution. The SDK also tracks various click IDs, such as `gclid` (Google), `fbclid` (Facebook), `ttclid` (TikTok), and others along with `referrer` and `referring_domain` that are captured to track the source of traffic.

For session and device parameters, the newer `ampSessionId` and `ampDeviceId` take precedence over their older counterparts (`sessionId` and `deviceId`). While the older parameters are still supported for backward compatibility, it is recommended to transition to the newer parameters (`ampSessionId` and `ampDeviceId`) to ensure consistency with the latest SDK updates.

Let me know if you have any questions!

Best,
Jarren


P.S. Checkout upcoming events and user meetups on our events page.

Hi ​@jarren.patao - that’s a very helpful summary, thanks! Just for my future reference, is this information also available together somewhere in the documentation that I missed? I know some of what you listed is available in this section on Marketing Attribution, but to find the deviceId info I had to go looking separately for the cross-domain tracking docs, but even then I didn’t see any mention of still supporting the older “sessionId”.

 

Thanks again!


Hi Robby,

I'm glad you found the summary helpful! You're correct that this information is spread across different sections of our documentation. The Marketing Attribution (https://amplitude.com/docs/sdks/analytics/browser/marketing-analytics-sdk#marketing-attribution) section covers the UTM, referrer, and click ID parameters. The Cross-Domain Tracking (https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#cross-domain-tracking) section discusses the ampDeviceId and ampSessionId parameters.

However, you're right that the continued support for the older 'sessionId' isn't explicitly mentioned in the documentation. I appreciate your feedback on this, and I'll pass it along to our documentation team for consideration in future updates.

Please don't hesitate to reach out if you have any more questions!

Best,
Jarren


P.S. Checkout upcoming events and user meetups on our events page.