Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // originally from Alex in Help Scout 20 February 2013
- add_filter("gform_confirmation", "custom_confirmation", 10, 4);
- function custom_confirmation($confirmation, $form, $lead, $ajax){
- if($form["id"] == "102"){
- $transaction_id = GFAuthorizeNet::$transaction_response["transaction_id"];
- $confirmation .= "<script type='text/javascript'>
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-2360178-80']);
- _gaq.push(['_trackPageview']);
- _gaq.push(['_addTrans','{$transaction_id}', // transaction ID - required
- 'American Knight Promotion', // affiliation or store name
- '{Total:24}', // total - required
- '0', // tax
- '0', // shipping
- '{Address (City):28.3}', // city
- '{Address (State / Province):28.4}', // state or province
- 'USA' // country
- ]);
- // add item might be called for every item in the shopping cart
- // where your ecommerce engine loops through each item in the cart and
- // prints out _addItem for each
- _gaq.push(['_addItem', '{$transaction_id}', // transaction ID - required
- '978-0-9882148-0-4', // SKU/code - required
- 'Return to Order - Hardcover', // product name
- 'Hard cover', // category or variation
- '{Return to Order - Hardcover (Price):26.2}', // unit price - required
- '{Return to Order - Hardcover (Quantity):26.3}' // quantity - required
- ]);
- _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- </script>";
- }
- return $confirmation;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement