Difference between referer type/name in piwik_log_visit and piwik_log_conversion


So I was running this query on the piwik database and found out that for the same visit (idvisit), if a goal was converted during that visit, the referer type/name is not the same in both tables?

Here is my query:

SELECT v.idvisit,

v.referer_type AS 'Visit referer_type',
c.referer_type AS 'Conversion referer_type'
FROM piwik_log_conversion c
JOIN piwik_log_visit v ON c.idvisit = v.idvisit
WHERE c.referer_type <> v.referer_type LIMIT 10 ;

And here is the result:

idvisit,“Visit referer_type”,"Conversion referer_type"

This is really puzzling me, and I’ve read through the documentation but could not find an answer to that.
Any insight would be greatly appreciated :smile:

Hi there,

Do you maybe use _paq.push(['setConversionAttributionFirstReferrer', true]); in your piwik javascript tracking code? refs: Piwik attributes conversions to the last seen referrer by default. How do I credit conversions to the first referrer instead? - Analytics Platform - Matomo

Hi Matthieu,

We have the referer_type and referer_name as columns of log_conversion, and those columns are not in the documentation. Moreover, they do not necessarily match the information stored in the visit that made the conversion. Any clue?


I’ve also encountered this behavior and we do not use the _paq.push(['setConversionAttributionFirstReferrer', true]); either. The faq 106 suggests that piwik looks at the last non direct entry ref type of current visitor, but I’ve found that there are conversions in which the last visits to conversion were all direct entry yet it was not attributed to direct entry.
Any ideas?

FAQ 106 says “Piwik will credit this Goal conversion to the last non empty referrer used by the visitor”, but non empty as in referer_url is not empty or that referrer_type is not 1, which does it consider, since referer_url can be non empty yet referer_type can be 1 in the log visit table.


Ok after digging around piwik, I see that it looks at the information from the cookie, to determine the referer_type of a conversion entry in the conversion log table. Piwik prioritizes the cookie information over what the current visit had entered in the visit log table. I assume as it has been said, that when piwik can’t get any information from the cookie it defaults to using the last non direct entry referer type from the visit log table for the conversion referer_type.