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!
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
Thanks for the effort! Any workarounds on this AI attribution? As obviously, we have to take this new AI channels into consideration.
Views
Replies
Total Likes
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..
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies