Referral URL bug


  1. A visitor visits my Facebook - Log In or Sign Up page
  2. A visitor clicks on a link on my Facebook - Log In or Sign Up page to visit my page

-----I can see that his referrer_url is

  1. A visitor creates a new account on my site
    ----a new record inside piwik_log_visit table is created with referral_url =

Question: Why is the second record created? Shouldn’t piwik know that this is the same visitor?

any ideas why this is happening? anyone?

I’m a little rusty, but I believe visits are affected by both cookies and time. I assume this is all showing up on the same visitor profile so the cookies are working right. Was there >30 minutes between the actions?

No this is not showing on user profile. The first visit is lost from the user profile. I can only see it inside the piwik_log_visit table.
And all of this happened within 3 minutes. So there is something funky going on.
I was able to reproduce this many times.

any other ideas?

If they aren’t getting attached to the same visit, then it’s worth checking whether or not the cookies are getting set.

Are you using the PHP Tracker or the JS Code? What version of Piwik?

What do you mean if cookies are getting set?
I can see piwik cookie. I don’t manipulate them.

I am using JS Code. Version 2.7.

What’s the URL for the two pages in your example? What’s the domain listed on the cookies in your browser (check separately on each page).

If you have any trouble finding the domain the cookies are assigned to, let me know what browser you’re using.

I was wrong. I am unable to see piwik cookies or I don’t know how to find them. I am using Chrome.
What’s piwik cookei name?


See the attached for a visual aid in finding the domain and path. Note that I’m using advanced configs so don’t assume yours are wrong just because mine do/don’t have something yours has…
[li] Hit F12 to bring up the developer tools
[/li][li] Click on the Resoruces tab
[/li][li] Under cookies, find the site you’re visit
[/li][li] For the cookies starting with _pk, note both the domain and path

[attachment 1984 cookiedomainandpath.png]

OK thanks,
Got the cookies and yes I can confirm that there are 3 _pk cookies.
The domain is correct on both pages (before and after sign up).

_pk_ref.*** cookie holds url.

Attached are before and after sceenshots.

[li] Those picture are from the two different pages (facebook landing page and whatever page reports the referrer), not one specific page before & after and
[/li][li] There isn’t an extra set of _pk keys on one of the pages (i.e. an additional group of 1-3 cookies listing a different path)
… I don’t see any reason why the two actions would end up on different visits.

I’m happy to throw out some other diagnostic strategies, but I’ve never had problems with the JS code so I’ve exhausted the kinds of issues I’ve seen before.

Thats correct

before_signup is a screenshot from a page that visitors sees after he clicks on a link from our facebook page

after_signup is a screenshot after he signs up (creates an account)

*between those 2 screenshots he maybe clicking around our site and then he decides to sign up.

So, as you can see our main goal is to find out how many visitros who came from facebook create accounts with us.

If you do actually click around your website after coming from Facebook, is it always the same page when the new visit starts? Is it always the confirmation page after registering? Or perhaps the page with the form to register?

Assuming it’s the confirmation page (to try and save back-and-forth):
[li] Does the preceding (in this case signup) page always appear in the history of page?
[/li][li] What are the URLs for the signup (preceding) and confirmation (new visit starts) page?
[/li][li] What URL is the target of the signup form (easy if the page is listed in the form action= section, hard if it’s done by javascript)? I’m mostly trying to confirm that the signup process occurs on the same subdomain… not redirecting to and back to
[/li][li] Can you view source and grab the Piwik Java code on the confirmation page (obfuscating domains if you prefer)