JS tracker, referer and single page app

517 views
Skip to first unread message

Anton Kirillov

unread,
Oct 31, 2014, 8:40:20 AM10/31/14
to snowpl...@googlegroups.com
Hello guys!

I'm testing snowplow SJ tracker on site with "single page" frontend architecture. And I've got an issue with "referer". 

For example:

1. We on http://site/a. Click on link /b

2. Browser opens page /b. Referer header is "http://site/a". 
(page /b is a "single page" which makes body after data is requested thru ajax)

3. On the page /b we click on link /b2 and app does:
- gets /b2 thru ajax and show it in the body
- sets the page url as /b2 thru the JS code
- calls the snowplow user event

Finally we see:
(it's incorrect)
- current page url is /b2
(window.location.href = "http://site/b2", window.top.document.referrer = "http://site/a")

It seems that snowplow generate wrong referer and as result we have wrong source (referer) for user events.

1. Do you know about this behavior?
2. Is it a bug? 
3. How can we send correct actual referer?

Anton Kirillov

unread,
Oct 31, 2014, 8:43:42 AM10/31/14
to snowpl...@googlegroups.com
SJ tracker

JS tracker )

Alex Dean

unread,
Oct 31, 2014, 8:52:11 AM10/31/14
to snowpl...@googlegroups.com
git clone https://github.com/snowplow/snowplow-javascript-tracker.git
grep -ri "refer[r?]er" snowplow-javascript-tracker/src


Take a look at the returned function to see how the Snowplow JavaScript Tracker grabs the referer. The solution may be some history.pushState-style manipulation on the AJAX side, or there may be something achievable on the JS Tracker side (or a combo of both).

Let us know how you get on!

A

--
You received this message because you are subscribed to the Google Groups "Snowplow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snowplow-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Co-founder
Snowplow Analytics
The Roma Building, 32-38 Scrutton Street, London EC2A 4RQ, United Kingdom
+44 (0)203 589 6116
+44 7881 622 925
@alexcrdean

Fred Blundun

unread,
Oct 31, 2014, 8:55:07 AM10/31/14
to snowpl...@googlegroups.com
Hi Anton,

It's possible to override the referrer url using the setReferrerUrl function:

snowplow_name_here("setReferrerUrl", "http://site/b");

Does that answer your question?

Regards,

Fred

Alex Dean

unread,
Oct 31, 2014, 8:56:24 AM10/31/14
to snowpl...@googlegroups.com
Thanks Fred!

--
You received this message because you are subscribed to the Google Groups "Snowplow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snowplow-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anton Kirillov

unread,
Oct 31, 2014, 9:53:27 AM10/31/14
to snowpl...@googlegroups.com
Thanks!
I'll check it.


On Friday, October 31, 2014 3:40:20 PM UTC+3, Anton Kirillov wrote:
Reply all
Reply to author
Forward
0 new messages