Skip to main content
Level 3
Sep 18, 2025 10:16 AM UTC
Solved

How to capture AI generated results from Google?

Hello,

 

As you all know, now Google usually generates an AI result for any search, giving you the sources it used on the right. If you click on those, it will take you to your site URL appending something like "#:~:text" to it.

 

I have created a Marketing Channel to allocate traffic coming from sites like Chat GPT and so to "AI traffic", and I want to send these AI generated results to this bucket. The problem is that I don't know how to capture this "#:~:text=" used by Google. Neither window.location.hash nor window.location.href worked :s.

 

Any ideas? I would also appreciate if you shared any other tips regarding the use of AI as a Marketing Channel.

 

Thanks!

Jennifer_Dungan
Jennifer_DunganAccepted solution
Adobe Champion and Community Advisor
Sep 22, 2025 2:27 PM UTC

Ah good catch, I didn't realize that Scroll To Text Fragments were available in the performance object.

 

However, there is still nothing that prevents other, non-AI systems from using this type of fragment notation. Scroll to Text is just that, a way to scroll to a position on a page where specific text appears... this isn't limited to AI Mode.

 

I would be tempted to merge this with a referral check (making sure that this is only coming from Google, or other known AI sources that use this type of fragment - to avoid potential inflation)

 

It will be interesting to see if Adobe has built this logic into their new AI Referrer Type... 

 

But definitely something to play with, thanks @mjdavid007 

8 replies

Jennifer_Dungan
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
Sep 18, 2025 10:40 PM UTC

I was just posting about this in another thread... for some reason this newer hash version doesn't seem to be extractable....

 

If I have a normal hash (#something), I can use window.location.hash to get the hash value

However, if I do this on this newer "scroll to text" hash, the above doesn't work....

 

I've tried multiple attempts, and all have failed.

Translate
Level 3
Sep 19, 2025 7:03 AM UTC

Thanks for the effort! Any workarounds on this AI attribution? As obviously, we have to take this new AI channels into consideration.

Translate
Jennifer_Dungan
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
Sep 19, 2025 1:07 PM UTC

I believe that is more focused on "traditional" AI sites like ChatGPT.. but I guess we will see.

 

Google really hasn't done anyone any favours to identifying their AI results.. 

Translate
Vinay_Chauhan
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
Sep 19, 2025 8:05 PM UTC

The #:~:text fragment that Google appends is part of the Scroll-to-Text Fragment API

Unlike standard URL hashes, it isn’t exposed through window.location.hash for privacy and security reasons, which is why you’re not able to capture it directly in JavaScript.

If your goal is to track visits coming from Google AI-generated results, a more reliable approach is to key off the referrer (Google domains) combined with the presence of the fragment pattern in the landing URL captured server-side (since some servers log the full request including fragments). If server logs don’t give you access to it, you may need to rely on referrer plus other identifiers, rather than trying to parse the fragment on the client.

At the moment, there isn’t a client-side workaround that will expose the #:~:text portion.

Translate
Level 3
Sep 21, 2025 8:35 PM UTC

Wouldn't it work with an approach like this? https://www.owntag.eu/blog/scroll-to-text-fragments-in-ga4/ It seems to be working on GA4...

 

function test() {  if (performance && performance.getEntries()[0].name.indexOf("#:~:text=") != -1) {      var entries = decodeURIComponent(performance.getEntries()[0].name.match("#:~:text=(.*)")[1]);      var frag = entries.replace(/, /g,"*").replace(/,/g,"...").replace(/\*/g,", ");      return frag;  }  else return ""}

  

Translate
Jennifer_Dungan
Adobe Champion and Community Advisor
Jennifer_DunganAdobe Champion and Community AdvisorAccepted solution
Adobe Champion and Community Advisor
Sep 22, 2025 2:27 PM UTC

Ah good catch, I didn't realize that Scroll To Text Fragments were available in the performance object.

 

However, there is still nothing that prevents other, non-AI systems from using this type of fragment notation. Scroll to Text is just that, a way to scroll to a position on a page where specific text appears... this isn't limited to AI Mode.

 

I would be tempted to merge this with a referral check (making sure that this is only coming from Google, or other known AI sources that use this type of fragment - to avoid potential inflation)

 

It will be interesting to see if Adobe has built this logic into their new AI Referrer Type... 

 

But definitely something to play with, thanks @mjdavid007 

Translate
manpreetkaur27
Adobe Support
Adobe Support
May 13, 2026 8:05 PM UTC

Hi ​@mjdavid007 
I’m following up to check whether any of the responses helped resolve your query. If so, kindly consider marking the most helpful response as the best answer.

Translate