{"id":7882,"date":"2023-08-12T15:57:25","date_gmt":"2023-08-12T22:57:25","guid":{"rendered":"https:\/\/membermouse.com\/?post_type=ht_kb&#038;p=7882"},"modified":"2024-01-23T14:03:58","modified_gmt":"2024-01-23T19:03:58","slug":"integrar-manualmente-com-um-sistema-de-afiliados","status":"publish","type":"ht_kb","link":"https:\/\/membermouse.com\/pt\/docs\/manually-integrate-with-an-affiliate-system\/","title":{"rendered":"Integra\u00e7\u00e3o manual com um sistema de afiliados"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">Basic Integration<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Most affiliate systems will provide you with a tracking code that you can insert on a thank you page or confirmation page. Since this page is only displayed to the customer following a purchase, including the tracking code here means that you're only tracking commissions when a sale has occurred. In MemberMouse you can&nbsp;<a href=\"https:\/\/membermouse.com\/docs\/create-product-specific-confirmation-page\/\" target=\"_blank\" rel=\"noreferrer noopener\">create confirmation pages that are specific to the product being purchased<\/a>. This is where you would paste your tracking code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tracking codes will differ from system to system, but they will typically look something like this: <br><br><code>&lt;img border=\"0\" src=\"http:\/\/www.youraffiliatesystem.com\/sale.php? affiliate_id=[ MM_Order_Data name='affiliateId' ]& order_total=[ MM_Order_Data name='total' ]& order_number=[ MM_Order_Data name='id' ]& ip_address=[ MM_Order_Data name='ipAddress' ]\" width=\"1\" height=\"1\"&gt;<\/code><\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">All you need to do is use MemberMouse SmartTags\u2122 to pass the appropriate data to the tracking code as demonstrated above. Read this article to&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/membermouse.com\/docs\/order-data-smarttag-mm_order_data\/\" target=\"_blank\">get a complete list of order data available with the&nbsp;Order_Data&nbsp;SmartTag<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:\u00a0<\/strong>\u00a0When you use this approach you won't be able to take advantage of commission profiles or partner payouts. This is because you're manually tracking a commission on the confirmation page so you're bypassing the place where MemberMouse determines whether to track the commission based on\u00a0<a href=\"https:\/\/membermouse.com\/docs\/affiliate-integration-overview\/\">commission profile and partner payout configurations<\/a>.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Advanced Integration<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">You can\u00a0<a href=\"https:\/\/membermouse.com\/docs\/create-a-commission-profile\/\" target=\"_blank\" rel=\"noreferrer noopener\">create commission profiles<\/a>\u00a0and\u00a0<a href=\"https:\/\/membermouse.com\/docs\/affiliate-integration-overview\/\">define partner payouts<\/a>\u00a0in MemberMouse that allow you to configure when you want to track commissions. In order to take advantage of these configurations, you'll need to let MemberMouse inform you when to make a call to your affiliate system to track a commission. You can accomplish this by listening for affiliate push notifications or creating functions that respond to affiliate WordPress hooks.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Affiliate Push Notifications<\/strong><\/h6>\n\n\n\n<p class=\"wp-block-paragraph\">One way to ensure you're only tracking commissions in accordance with commission profiles and partner payout configurations is to put all of the code required to inform your affiliate system in scripts that are called by the MemberMouse push notification system. Read this article to&nbsp;<a href=\"https:\/\/membermouse.com\/docs\/call-a-custom-script-when-certain-events-occur\/\" target=\"_blank\" rel=\"noreferrer noopener\">learn how to call a custom script when affiliate events occur<\/a>.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Affiliate WordPress Hooks<\/strong><\/h6>\n\n\n\n<p class=\"wp-block-paragraph\">Another way to ensure that you're only tracking commissions in accordance with commission profiles and partner payout configurations is to put all of the code required to inform your affiliate system in functions that are tied to affiliate WordPress hooks. Below is an example of how you could attach a function to the\u00a0mm_commission_initial\u00a0hook. Read this article to\u00a0<a href=\"https:\/\/membermouse.com\/docs\/membermouse-wordpress-hooks\/\" target=\"_blank\" rel=\"noreferrer noopener\">learn more about using affiliate WordPress hooks<\/a>. <\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>add_action('mm_commission_initial', 'track_commission');\nfunction track_commission($data)\n{\n    $orderNumber = $data&#91;\"order_number\"];\n    $orderTotal = $data&#91;\"order_total\"];\n    $orderAffiliateId = $data&#91;\"order_affiliate_id\"];\n    $orderIPAddress = $data&#91;\"order_ip_address\"];\n\n    \/\/ access coupons associated with the order\n    $couponCode = \"\";\n    $coupons = json_decode(stripslashes($data&#91;\"order_coupons\"]));\n    foreach($coupons as $coupon)\n    {\n        $couponCode = $coupon-&gt;code;\n        break;\n    }\n    \n    \/\/ generate URL to track commission\n    $url = \"http:\/\/www.youraffiliatesystem.com\/sale.php?\";\n    $url .= \"affiliate_id={$orderAffiliateId}&\";\n    $url .= \"order_total={$orderTotal}&\";\n    $url .= \"order_number={$orderNumber}&\";\n    $url .= \"coupon_code={$couponCode}&\";\n    $url .= \"ip_address={$orderIPAddress}\";\n\n    \/\/ call URL using cURL\n    $request = curl_init($url);\n    curl_exec($request);\n}<\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Integra\u00e7\u00e3o b\u00e1sica A maioria dos sistemas de afiliados fornece um c\u00f3digo de rastreamento que pode ser inserido em uma p\u00e1gina de agradecimento ou de confirma\u00e7\u00e3o. Como essa p\u00e1gina s\u00f3 \u00e9 exibida...<\/p>","protected":false},"author":21411,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"om_disable_all_campaigns":false,"_strive_editorial_status":"not-started","_strive_copy_of":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"ht-kb-category":[171],"ht-kb-tag":[],"class_list":["post-7882","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-affiliate-integrations"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/membermouse.com\/pt\/wp-json\/wp\/v2\/ht-kb\/7882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/membermouse.com\/pt\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/membermouse.com\/pt\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/membermouse.com\/pt\/wp-json\/wp\/v2\/users\/21411"}],"replies":[{"embeddable":true,"href":"https:\/\/membermouse.com\/pt\/wp-json\/wp\/v2\/comments?post=7882"}],"version-history":[{"count":0,"href":"https:\/\/membermouse.com\/pt\/wp-json\/wp\/v2\/ht-kb\/7882\/revisions"}],"wp:attachment":[{"href":"https:\/\/membermouse.com\/pt\/wp-json\/wp\/v2\/media?parent=7882"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/membermouse.com\/pt\/wp-json\/wp\/v2\/ht-kb-category?post=7882"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/membermouse.com\/pt\/wp-json\/wp\/v2\/ht-kb-tag?post=7882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}