Last active
October 29, 2024 13:02
-
-
Save xlplugins/250fa5c05712b1508338f346c53c61ef to your computer and use it in GitHub Desktop.
tapfiliate tracking script #Upstroke #tracking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Rendering Custom tapfiliate tracking script for thank you and upsell pages. | |
| * | |
| * @param $general_data | |
| */ | |
| function wfocu_render_tapfiliate_script_tracking( $general_data ) { | |
| if ( ! is_array( $general_data ) || 0 === count( $general_data ) ) { | |
| return; | |
| } | |
| $order_id = isset( $general_data['order_id'] ) ? $general_data['order_id'] : 0; | |
| if ( 0 === $order_id && isset( $_GET['order_id'] ) ) { | |
| $order_id = $_GET['order_id']; | |
| } | |
| if ( empty( $order_id ) ) { | |
| return; | |
| } | |
| $order = wc_get_order( $order_id ); | |
| if ( empty( $order ) || ! $order instanceof WC_Order ) { | |
| return; | |
| } | |
| $user_id = $order->get_user_id(); | |
| ?> | |
| <script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script> | |
| <script type="text/javascript"> | |
| if (undefined !== wfocu_tracking_data && '' !== wfocu_tracking_data) { | |
| (function (t, a, p) { | |
| t.TapfiliateObject = a; | |
| t[a] = t[a] || function () { | |
| (t[a].q = t[a].q || []).push(arguments) | |
| } | |
| })(window, 'tap'); | |
| tap('create', 'YOUR ACCOUNT ID', {integration: "javascript"}); | |
| tap('conversion', wfocu_tracking_data.transaction_id, wfocu_tracking_data.total, {customer_id: <?php echo $user_id; ?>} | |
| ); | |
| } | |
| </script> | |
| <?php | |
| } | |
| add_action( 'wfocu_custom_purchase_tracking', 'wfocu_render_tapfiliate_script_tracking' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment