Difference between revisions of "Integrating PayPal Commerce Tracking"
m |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
That said, [[ConversionRuler]] has a solution which works with [[PayPal]]. | That said, [[ConversionRuler]] has a solution which works with [[PayPal]]. | ||
+ | |||
+ | To start, you need to [[configure PayPal up to use ConversionRuler's IPN Gateway]]. | ||
= Setting up your PayPal form = | = Setting up your PayPal form = | ||
Line 26: | Line 28: | ||
This passes the ConversionRuler cookie, site, and action code to PayPal for final processing when the transaction is complete. | This passes the ConversionRuler cookie, site, and action code to PayPal for final processing when the transaction is complete. | ||
+ | |||
+ | The variables being passed to us are: | ||
+ | |||
+ | * '''crcookie''' - This is set in our tracking snippet in the global scope. Please be sure to include our tracking snippet '''before this code on the page''' (meaning before the form). If this code runs inside of a closure, use '''window.crcookie''' instead. | ||
+ | * '''siteid''' - This is set in our tracking snippet as well, in the global scope. | ||
+ | * '''craction''' - The action number to record. This is configured in '''[[Manage Actions]]''' and corresponds to a commerce transaction. | ||
= Connecting from PayPal IPN = | = Connecting from PayPal IPN = | ||
Line 31: | Line 39: | ||
Once the visitor goes to PayPal, the only method of communication is via [https://www.paypal.com/ipn PayPal IPN]. You can use ConversionRuler's fault-tolerant servers for this notification, but most likely, your server will have its own IPN software which you'll need to hook into. | Once the visitor goes to PayPal, the only method of communication is via [https://www.paypal.com/ipn PayPal IPN]. You can use ConversionRuler's fault-tolerant servers for this notification, but most likely, your server will have its own IPN software which you'll need to hook into. | ||
− | If you want to use ConversionRuler's IPN gateway, the URL is as follows: | + | If you want to use [[Configure PayPal to use ConversionRuler's IPN Gateway|ConversionRuler's IPN gateway]], the URL is as follows: |
https://www.conversionruler.com/bin/paypal/ | https://www.conversionruler.com/bin/paypal/ | ||
− | Alternatively, you can parse the custom variable yourself in your own IPN gateway and pass it to | + | Alternatively, you can parse the custom variable yourself in your own IPN gateway and pass it to ConversionRuler. It can be passed directly to ConversionRuler's tracking script: |
<nowiki><?php | <nowiki><?php | ||
Line 44: | Line 52: | ||
$custom .= "&cramount0=" . urlencode($_REQUEST['mc_gross']); | $custom .= "&cramount0=" . urlencode($_REQUEST['mc_gross']); | ||
$custom .= "&crtext0=" . urlencode($_REQUEST['txn_id']); | $custom .= "&crtext0=" . urlencode($_REQUEST['txn_id']); | ||
− | file_get_contents("https://www.conversionruler.com/bin/tracker.php?" | + | file_get_contents("https://www.conversionruler.com/bin/tracker.php?" . $custom); |
}</nowiki> | }</nowiki> | ||
The above code notifies our server, passes the total amount and the transaction ID, and records the action as originally specified. Note that your PHP configuration on your server must support ''[http://us3.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen allow_url_fopen]'' which is generally available on most PHP servers. | The above code notifies our server, passes the total amount and the transaction ID, and records the action as originally specified. Note that your PHP configuration on your server must support ''[http://us3.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen allow_url_fopen]'' which is generally available on most PHP servers. | ||
− | If your IPN gateway is written in another language such as [[ASP]], [[Perl]], or [[Java]] then you can use a similar method to pass the parameters | + | If your IPN gateway is written in another language such as [[ASP]], [[Perl]], or [[Java]] then you can use a similar method to pass the parameters to our servers. |
For more information about PayPal and integration with [https://www.paypal.com/ipn PayPal IPN], contact [[MarketRuler Support]]. | For more information about PayPal and integration with [https://www.paypal.com/ipn PayPal IPN], contact [[MarketRuler Support]]. | ||
+ | |||
+ | == See also == | ||
+ | * [[Configure your PayPal IPN script to notify ConversionRuler]] | ||
+ | * [[Configure PayPal to use ConversionRuler's IPN Gateway]] | ||
+ | |||
+ | [[Category:ConversionRuler]] | ||
+ | [[Category:ConversionRuler Cart Installation]] | ||
+ | [[Category:ConversionRuler Tracking]] | ||
+ | [[Category:Needs Review]] |
Latest revision as of 16:37, 17 May 2018
PayPal integration with Commerce Tracking is somewhat complex due to the fact that:
- PayPal transactions occur solely on their domain https://www.paypal.com/
- PayPal does not allow any third-party software, scripts, or image pixels to be installed as part of their commerce accounts, and ...
- PayPal only allows "behind-the-scenes" notification of transaction success using their API called PayPal IPN
That said, ConversionRuler has a solution which works with PayPal.
To start, you need to configure PayPal up to use ConversionRuler's IPN Gateway.
Setting up your PayPal form
First, you need to send PayPal enough information so that ConversionRuler can uniquely identify the transaction and original landing data. To do this, you solely need to pass the ConversionRuler Cookie which is stored in the JavaScript global variable crcookie.
To do so, in your PayPal form, do the following:
<script type="text/javascript"> var craction = 3; </script> <form method="post" action="https://www.paypal.com/cgi-bin/webscr" name="paypal"> ... add the following between the form tags ... <script type="text/javascript"> document.write('<input type="hidden" name="custom" value="siteid=' + siteid + '&crcookie=' + crcookie + '&craction=' + craction+'" />'); </script> </form>
Please note the above code uses single quotes and double-quotes - they are not the same, so please cut and paste carefully.
This passes the ConversionRuler cookie, site, and action code to PayPal for final processing when the transaction is complete.
The variables being passed to us are:
- crcookie - This is set in our tracking snippet in the global scope. Please be sure to include our tracking snippet before this code on the page (meaning before the form). If this code runs inside of a closure, use window.crcookie instead.
- siteid - This is set in our tracking snippet as well, in the global scope.
- craction - The action number to record. This is configured in Manage Actions and corresponds to a commerce transaction.
Connecting from PayPal IPN
Once the visitor goes to PayPal, the only method of communication is via PayPal IPN. You can use ConversionRuler's fault-tolerant servers for this notification, but most likely, your server will have its own IPN software which you'll need to hook into.
If you want to use ConversionRuler's IPN gateway, the URL is as follows:
https://www.conversionruler.com/bin/paypal/
Alternatively, you can parse the custom variable yourself in your own IPN gateway and pass it to ConversionRuler. It can be passed directly to ConversionRuler's tracking script:
<?php /* This is your custom IPN processing file */ ... regular IPN tracking ... $custom = isset($_REQUEST['custom']) ? $_REQUEST['custom'] : null; if ($custom) { $custom .= "&cramount0=" . urlencode($_REQUEST['mc_gross']); $custom .= "&crtext0=" . urlencode($_REQUEST['txn_id']); file_get_contents("https://www.conversionruler.com/bin/tracker.php?" . $custom); }
The above code notifies our server, passes the total amount and the transaction ID, and records the action as originally specified. Note that your PHP configuration on your server must support allow_url_fopen which is generally available on most PHP servers.
If your IPN gateway is written in another language such as ASP, Perl, or Java then you can use a similar method to pass the parameters to our servers.
For more information about PayPal and integration with PayPal IPN, contact MarketRuler Support.