Appearance
Track Thank You Page
Call trackThankYouPageViewed() on your final "Thank You" or order confirmation page.
Important
trackOrder() should be called before this method for full attribution and commission calculation.
Usage
javascript
<script>
const thankYouData = {
orderId: "ORD-123",
customer: {
email: "user@example.com"
}
};
AffiliateSDK.trackThankYouPageViewed(thankYouData);
</script>php
<?php
if ( is_order_received_page() ) {
global $wp;
$order_id = $wp->query_vars['order-received'];
$order = wc_get_order( $order_id );
if ( $order ) :
?>
<script>
const thankYouData = {
orderId: "<?php echo $order->get_order_number(); ?>",
customer: {
email: "<?php echo $order->get_billing_email(); ?>"
}
};
if (window.AffiliateSDK) {
AffiliateSDK.trackThankYouPageViewed(thankYouData);
}
</script>
<?php
endif;
}
?>liquid
{% if first_time_accessed %}
<script>
const thankYouData = {
orderId: "{{ order.name }}",
customer: {
email: "{{ order.email }}"
}
};
if (window.AffiliateSDK) {
AffiliateSDK.trackThankYouPageViewed(thankYouData);
}
</script>
{% endif %}jsx
import { useEffect } from "react";
export default function ThankYouPage({ order }) {
useEffect(() => {
const thankYouData = {
orderId: order.id,
customer: {
email: order.email
}
};
if (window.AffiliateSDK) {
window.AffiliateSDK.trackThankYouPageViewed(thankYouData);
}
}, [order]);
return <h1>Thank You for your purchase!</h1>;
}vue
<script setup lang="ts">
const { order } = defineProps(['order']);
onMounted(() => {
const thankYouData = {
orderId: order.id,
customer: {
email: order.email
}
};
if (window.AffiliateSDK) {
window.AffiliateSDK.trackThankYouPageViewed(thankYouData);
}
});
</script>
<template>
<h1>Thank You for your purchase!</h1>
</template>