greenorahosting Posted November 23, 2020 Share Posted November 23, 2020 Hi everyone, i'm having some problem with a conversion tag for an affiliate platform (Tradedoubler). When i complete an order, the affiliate platform doesn't show that was completed by an affiliate program. Before i start i have to specify that i use WHMCS Bridge on Wordpress. This is the code that Tradedoubler gave to me <!-- Start TradeDoubler Landing Page Tag Insert on all landing pages to handle first party cookie--> <script language="JavaScript"> (function(i,s,o,g,r,a,m){i['TDConversionObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script', 'https://svht.tradedoubler.com/tr_sdk.js', 'tdconv'); </script> <!-- End TradeDoubler tag--> I insert this first part in the Google Tag Manager, with a variable to handle first part cookie. (as suggested by Tradedoubler) Than this is the second part, for the conversion tag <!-- Start TradeDoubler Conversion Tag Insert on confirmation Page --> <script language="JavaScript"> tdconv('init', '2269371', {'element': 'iframe' }); tdconv('track', 'sale', {'transactionId':'[ORDER_NUMBER]', 'ordervalue':[ORDER_VALUE], 'voucher':'[VOUCHER_CODE]', 'currency':'EUR', 'event':404916}); </script> <!-- End TradeDoubler tag--> I installed this in complete.tpl in the suggested part of {if $ispaid}. I also need to insert the total import of the order and the Order ID from WHMCS in the script. From what i found on the internet, i've adapted the code as follows: {if $ispaid} <!-- Enter any HTML code which should be displayed when a user has completed checkout here --> <!-- Common uses of this include conversion and affiliate tracking scripts --> <!-- Start TradeDoubler Conversion Tag Insert on confirmation Page --> {literal} <script language="javascript"> tdconv('init', '2269371', {'element': 'iframe' }); tdconv('track', 'sale', {'transactionId':'{$orderid}', 'ordervalue':'{$total}', 'voucher':'', 'currency':'EUR','event':404916}); </script> {/literal} <!-- End TradeDoubler tag--> {/if} I had to insert {literal} because without it, the page became totally white... Where is the error? It's two days that i try to resolve it 😫 0 Quote Link to comment Share on other sites More sharing options...
greenorahosting Posted November 24, 2020 Author Share Posted November 24, 2020 I've contacted directly Tradedoubler and they have verified that they receive correctly the communication. The only thing that i've to resolve now is to pass the WHMCS variables in to the script. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted November 24, 2020 WHMCS Developer Share Posted November 24, 2020 The {literal} tags stop any smarty parsing. That means, that the {$orderid} etc in your logic would never display. I would recommend taking out the literal tags, and replacing use of { and } anywhere you don't have a smarty variable with the {ldelim} and {rdelim} appropriately. See https://www.smarty.net/docs/en/language.function.ldelim.tpl for more information on that. Hope this helps you. 1 Quote Link to comment Share on other sites More sharing options...
greenorahosting Posted November 24, 2020 Author Share Posted November 24, 2020 Thanks for your help, i don't know if this is correct, but it gaves me again a white screen {if $ispaid} <!-- Enter any HTML code which should be displayed when a user has completed checkout here --> <!-- Common uses of this include conversion and affiliate tracking scripts --> <!-- Start TradeDoubler Conversion Tag Insert on confirmation Page --> {and} <script language="javascript"> {ldelim} tdconv('init', '2269371', {'element': 'iframe' }); tdconv('track', 'sale', {'transactionId':'{$orderid}', 'ordervalue':'{$amount}', 'voucher':'', 'currency':'EUR', 'event':404916}); {rdelim} </script> {/and} <!-- End TradeDoubler tag--> {/if} 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted November 24, 2020 WHMCS Developer Share Posted November 24, 2020 Hi, I think you confused what you needed to do. Remove the {literal} tags completely. Then, in the javascript, replace any { and } that aren't smarty, with the delims. I didn't mean for you to use {and} {if $ispaid} <!-- Enter any HTML code which should be displayed when a user has completed checkout here --> <!-- Common uses of this include conversion and affiliate tracking scripts --> <!-- Start TradeDoubler Conversion Tag Insert on confirmation Page --> <script language="javascript"> tdconv('init', '2269371', {ldelim}'element': 'iframe' {rdelim}); tdconv('track', 'sale', {ldelim}'transactionId':'{$orderid}', 'ordervalue':'{$total}', 'voucher':'', 'currency':'EUR','event':404916{rdelim}); </script> <!-- End TradeDoubler tag--> {/if} 0 Quote Link to comment Share on other sites More sharing options...
greenorahosting Posted November 25, 2020 Author Share Posted November 25, 2020 Hi Andrew, thanks for your help. I've contacted the Dev support of that company because it doesn't works, neither in this version you've just sent to me. The pages does not crash anymore but now it does not send anything... 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted November 25, 2020 WHMCS Developer Share Posted November 25, 2020 Do you see the HTML being output on the complete page? Remember that you have the output conditionally within the {if $ispaid} block and so that will only output if the order has been paid. 0 Quote Link to comment Share on other sites More sharing options...
greenorahosting Posted November 25, 2020 Author Share Posted November 25, 2020 Yes, the page is shown, and the script as you adapted is within {if $ispaid}. I completed an order via Stripe 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted November 25, 2020 Share Posted November 25, 2020 It's worth to remind that refreshing the page 2 times will trigger your "sale" event twice. 0 Quote Link to comment Share on other sites More sharing options...
greenorahosting Posted November 26, 2020 Author Share Posted November 26, 2020 Thanks you all for your help! At the end they gave me an iframe and now all works perfectly. I have a one final answer... What is the variable of the used voucher? 0 Quote Link to comment Share on other sites More sharing options...
Dave_Johns Posted January 7, 2021 Share Posted January 7, 2021 Hi @greenorahosting I've been reading this and I'm having the same issue. I wanna start working with an affiliate network (similar to tradedoubler) but I do not understand how to: 1. Paste the Google Tag Manager 2. Paste the pixel to track the sales 3. Share with the the Order ID and the Sales Amount. I would really appreciate if you could give me a hint or help me. Thanks in advance D. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.