Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paypal tracking: Tracking API improvements & how to #2222

Closed
mattab opened this issue Mar 23, 2011 · 13 comments
Closed

Paypal tracking: Tracking API improvements & how to #2222

mattab opened this issue Mar 23, 2011 · 13 comments
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Mar 23, 2011

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
Copy link
Member Author

mattab commented Apr 7, 2011

(In [4350]) PiwikTracker

@anonymous-matomo-user
Copy link

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)

See:

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables#id08A6HH00W2J

@mattab
Copy link
Member Author

mattab commented Apr 8, 2011

(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
Copy link
Member Author

mattab commented Apr 9, 2011

(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
Copy link
Member Author

mattab commented Apr 9, 2011

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
Copy link
Member Author

mattab commented Apr 10, 2011

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-matomo-user
Copy link

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

@mattab
Copy link
Member Author

mattab commented Apr 19, 2011

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-matomo-user
Copy link

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

@anonymous-matomo-user
Copy link

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

@mattab
Copy link
Member Author

mattab commented May 1, 2011

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
Copy link
Member Author

mattab commented Jun 1, 2011

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
Copy link
Member Author

mattab commented Jun 4, 2012

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

No branches or pull requests

2 participants