@mattab opened this Issue on March 23rd 2011 Member

See post in: http://forum.piwik.org/read.php?2,73977

I think we need to:

  • allow tracking by visitor ID, ie. the Tracking API should accept the visitor ID as a parameter, and use this to match the visitor (bypassing existing matching algorithm using IP etc)
  • JS API should have a getter for the referer cookie _pk_ref
  • Tracking API should have a parameter/new PiwikTracker function to set the referer for conversion attribution

Then we can also come up with a "How to" for tracking on Paypal. Of course these features will be useful for many other similar use cases.

@mattab commented on April 7th 2011 Member

(In [4350]) PiwikTracker

  • doc improvements
  • adding stubs for upcoming functionnality in Refs #2222
  • Refs #2172 PiwikTracker.java will need a few new functions when this work is finalized (will ping you when new API is final)
@anonymous-piwik-user commented on April 7th 2011

I too would be very interested in this use case; I stumbled across the forum post looking for exactly this. This would be extremely useful for getting very accurate associations between referrals and actual purchases!

I think that (for at least this specific use case), you would need to make use of PayPal's custom field to pass the visitor ID through IPN (Since only PayPal, and not the actual visitor, will pass data through IPN)



@mattab commented on April 8th 2011 Member

(In [4369]) Refs #2222 Implementing Visitor ID forced request, so that we can log, after the fact, a page/goal/action to the latest visit of a given visitor ID (useful for example to trigger goal conversions that were missed by the JS beacon...)
Had to add another index on the log_visit table unfortunately, to ensure reasonnably fast lookup on the idvisitor, even though this index will very rarely get used (never if you don't use the tracking API with setVisitorId()...)

@mattab commented on April 9th 2011 Member

(In [4378]) Fixes #2168

  • Now crediting the right referrer for any goal conversion
  • Referrer URLs, timestamp, and Campaign name & keyword (parsed from the landing page URL) are now stored in a first party cookie (JSON encoded)
  • Added getters to the piwik.js to allow passing the values from the client, to store for later use in the PHP/Java Tracking API (paypal use case)
  • Added integration tests and basic JS tests

Refs #2172

  • Added a new API function: setAttributionInfo( $jsonEncoded ) which accepts JSON encoded array of 4 values (see implementation for details what to do with these values)
  • 2 new parameters are: _rcn and _rck to pass to piwik the campaign name and campaign keyword that will be creditted for the Goal conversion (if a goal is converted)
  • Also renamed setUrlReferer to setUrlReferrer -- Important that all public facing APIs use the proper writing

Refs #2222 Accurate Paypal tracking (or any other third party "after the fact" Goal conversion): implementation is now done, we must write some kind of guide and test

@mattab commented on April 9th 2011 Member

matheweis, I think you can now try and get this to work. Here is a proposal / pseudo code:

  • before user leave your site to go to Paypal, call the following JS functions:
    • visitorId = piwikTracker.getVisitorId();
    • attributionInfo = JSON2.stringify(piwikTracker.getAttributionInfo());
  • store these values in a database or similar
  • then when Paypal call you back via IPN
    • use the PHP Tracking API to record the conversion
    • you must call the following functions at least to credit the right visit with the right referrer information
    • $tracker->setVisitorId( $visitorId ); // which you stored earlier
    • $tracker->setAttributionInfo( $attributionJsonEncoded ); // which you stored earlier
    • $tracker->setTokenAuth( $your_superUser_token_auth ); // see http://piwik.org/faq/general/#faq_114
    • $tracker->doTrackGoal($idGoal, $revenue);

Then, Piwik will record, for the visit that was redirected to Paypal, the Goal conversion, making sure the Referrer (search engine, or website) or the Campaign (and keyword) used to reach the site in the first place, are credited for this goal conversion.

It would be great if you could give it a try and report if it is working :)

@mattab commented on April 10th 2011 Member

matheweis, now is a good time to help with the Paypal stuff if you can :) PLease see my post in the forum: http://forum.piwik.org/read.php?2,73977,page=1#msg-74946 and if you can test it and report, it would be great thanks!

@anonymous-piwik-user commented on April 19th 2011

After implementing this and running it for several days, I can confirm that it's working. Thanks Matt!

@mattab commented on April 19th 2011 Member

Thanks for your patience and help in getting this to work nicely!

Do you think you would be able to write a short, practical how to to get Paypal tracking work for other Piwik users? it would be great. I will then write a documentation about campaign tracking and to explain attribution in general.

@anonymous-piwik-user commented on April 19th 2011

Sure thing. I'll try to work on that this week.

@anonymous-piwik-user commented on May 1st 2011

Basic how to guide posted in forum: [http://forum.piwik.org/read.php?2,76296]

@mattab commented on May 1st 2011 Member

Thanks morrack, very appreciated! Maybe, we can wait a few weeks see if the post gets any feedback, and then turn it into some kind of official How to for piwik.org/docs/ ?

@mattab commented on June 1st 2011 Member

When we put this tutorial online as an "official doc", we could also write a section about "How to record recurrent payments / conversions using Piwik" which would explain how to track revenue from monthly memberships, and still credit the money to the initial referrer that brought in the visitor, credit the right keyword/country/etc.

@mattab commented on June 4th 2012 Member
This Issue was closed on July 8th 2012
Powered by GitHub Issue Mirror