Jump to content

Conversion Tag Error in complete.tpl


Recommended Posts

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 😫

Link to comment
Share on other sites

  • WHMCS Developer

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.

Link to comment
Share on other sites

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}

 

Link to comment
Share on other sites

  • WHMCS Developer

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}

 

 

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated