Zen Cart Logo
Forums / General Questions / Where to put my Affiliate Tracking Code??

Where to put my Affiliate Tracking Code??

Locked

Views: 8,377

Results 1 to 20 of 28
This thread is locked. New replies are disabled.
7 Nov 2008, 9:46 PM
#1
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Where to put my Affiliate Tracking Code??

Company Name: Payne-Mason
ZenCart: v1.3.7

I have the following javascript code for some affiliate tracking and I'm having problems identifying where and what file I need to insert this into:

<!-- Payne-Mason Tag Begins Here --> <script language='Javascript'> document.write( '<scr'+'ipt language="Javascript" src="' ); if( document.location.toString().indexOf( 'https://' ) != -1 ){ document.write( 'https' ); } else { document.write( 'http' ); } document.write( '://hits.affiliatetraction.com/cgi-bin/convert?js=1&offer=4656&amount=[DYNAMIC AMOUNT]&uid=[UNIQUE TRANSACTION ID]"><\/scr'+'ipt>' ); </script>

<noscript><img src='http://hits.affiliatetraction.com/cgi-bin/convert?offer=4656&amount=[DYNAMIC AMOUNT]&uid=[UNIQUE TRANSACTION ID]' border=0 width=1 height=1></noscript>

<!-- Payne-Mason Tag Ends Here -->

Any insight would be awesome... everywhere I've tried to insert it...it messes up the file/page I inserted it into...

7 Nov 2008, 10:15 PM
#2
neon_phoenix avatar

neon_phoenix

New Zenner

Join Date:
Dec 2007
Posts:
34
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

It will go in the tpl_main_page.php located in your template folder.

http://www.yoursite.com/includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php
8 Nov 2008, 12:46 AM
#3
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

Phoenix you are AWESOME! Thank you!! It works! I just don't know what the Dynamic Tags are for [Customer ID #] and [Transaction #] for the order? Any idea what those are so the script can identify and send that info through? Thanks Again!

8 Nov 2008, 5:56 AM
#4
chuck avatar

chuck

Totally Zenned

Join Date:
Jul 2005
Posts:
255
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

Actually, if you're tracking only from the checkout-success page, you need to take it out of the tpl-main-page file (since that's used on every page), and put it into a copy of tpl_footer.php that you store in a new folder, like this: /includes/templates/YOUR_TEMPLATE/checkout_success/tpl_footer.php
Then you can substitute those dynamic pieces for the data available on that page.

You can see an example of that on the JROX JAM website where it talks about integration with Zen Cart.

13 Nov 2008, 12:06 AM
#5
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

Does anyone know what the code or tag for Transaction ID (order #) and also Transaction ammount (subtotal $ for the order) ... I have a software code to track the order and need to imput these 2 things..

[DYNAMIC AMOUNT]
[UNIQUE TRANSACTION ID]

I have tested it a couple times but keep inserting the wrong identifiers :(

13 Nov 2008, 12:11 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where to put my Affiliate Tracking Code??

chuck's suggestion above will point you to code that does the same sort of thing for an afffiliate manager already integrated for Zen Cart.

Namely:

  • $order_summary['commissionable_order']
  • $order_summary['order_number']
    respectively.
13 Nov 2008, 12:46 AM
#7
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

Yeah, I looked into Chuck's suggestion and tried it too, but unless you are using the Affiliate Software he referances... it is no good. I am using a different kind. Are you suggesting all I need to do is put [commisionable_order] and [order_number] in the tags for my purposes? Thanks,

Dan

13 Nov 2008, 12:53 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where to put my Affiliate Tracking Code??

If you do it on tpl_footer.php in a checkout_success override folder, then you would use the variable names exactly as I mentioned them:

$order_summary['commissionable_order']
and
$order_summary['order_number']

13 Nov 2008, 1:50 AM
#9
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

Thanks, I only have one more question for this thread,
Do I have to make any adustments to the code or module, or if I put a /checkout_success new folder with a tpl.footer.php file (with the inputs you reccomended... will the zencart automatically figure out that there is a new folder and file it needs to read? Sorry if this is a dumb question, I am just learning about .php and zencart. I am hoping someday soon I will be able to help others like I am being helped!

p.s.- my affiliate code asks for me to adjust/imput : [UNIQUE TRANSACTION ID] into the code--should I put just the ['order_number'] in there or the whole [$order_summary['order_number']]

13 Nov 2008, 2:28 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where to put my Affiliate Tracking Code??

It seems you'll have to wrap some PHP tags around it, so, where it says [DYNAMIC AMOUNT] replace that with <?php echo $order_summary['commissionable_order'];?>
Same with the order id

13 Nov 2008, 2:31 AM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where to put my Affiliate Tracking Code??

danwebman:

Do I have to make any adustments to the code or module, or if I put a /checkout_success new folder with a tpl.footer.php file (with the inputs you reccomended... will the zencart automatically figure out that there is a new folder and file it needs to read?

Yes, Zen Cart will use the custom version of the file only when on the specified page.

ie: /includes/templates/YOUR_CUSTOM_TEMPLATE_NAME/checkout_success/tpl_footer.php

13 Nov 2008, 9:48 PM
#12
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

So I cant use any of the suggestions that Chuck has made because the affiliate tracking I am using is completely different... any way you have another reccomendation for me? I am really struggling with this and have a lot of people waiting for me to get this right... Here is the code: The instructions are to place this in the last page of the shopping cart transaction, to read it once the order is complete. But I get an error in the last checkout page every time I insert it into the code?

<!-- Payne-Mason Tag Begins Here --> <script language='Javascript'> document.write( '<scr'+'ipt language="Javascript" src="' ); if( document.location.toString().indexOf( 'https://' ) != -1 ){ document.write( 'https' ); } else { document.write( 'http' ); } document.write( '://hits.affiliatetraction.com/cgi-bin/convert?js=1&offer=4656&amount=[DYNAMIC AMMOUNT]&uid=[UNIQUE TRANSACTION ID]"><\/scr'+'ipt>' ); </script>

<noscript><img src='http://hits.affiliatetraction.com/cgi-bin/convert?offer=4656&amount=[DYNAMIC AMMOUNT]&uid=[UNIQUE TRANSACTION ID]' border=0 width=1 height=1></noscript>

<!-- Payne-Mason Tag Ends Here -->
14 Nov 2008, 12:40 AM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where to put my Affiliate Tracking Code??

Actually, chuck is quite correct.

But, instead of giving tips on the "how", let me spell it out for you:

  1. On your PC, find the /includes/templates/ folder

  2. If you don't already have a folder in there for your own custom template, create one. For purposes of this illustration, I'm going to call it NAME_OF_YOUR_CUSTOM_TEMPLATE_FOLDER. But, you should use something meaningful, like "nov2008" or "danweb".

  3. Inside that NAME_OF_YOUR_CUSTOM_TEMPLATE_FOLDER folder, create a "checkout_success" folder ... like chuck mentioned.

  4. Now find the /includes/templates/template_default/common/tpl_footer.php file and copy it to your /includes/templates/NAME_OF_YOUR_CUSTOM_TEMPLATE_FOLDER/checkout_success folder, like the JROX JAM instructions indicate.

  5. Using a text editor such as NotePad++, edit that NEW /includes/templates/NAME_OF_YOUR_CUSTOM_TEMPLATE_FOLDER/checkout_success/tpl_footer.php file.

  6. Just before the closing </body> tag, insert your affiliate code, like this:

<!-- Payne-Mason Tag Begins Here -->
<script language='Javascript'>
document.write( '<scr'+'ipt language="Javascript" src="' );
if( document.location.toString().indexOf( 'https://' ) != -1 ){ document.write( 'https' ); } else { document.write( 'http' ); }
document.write( '://hits.affiliatetraction.com/cgi-bin/convert?js=1&offer=4656&amount=[B]<?php echo $order_summary['commissionable_order']; ?>[/B]&uid=[B]<?php echo $order_summary['order_number']; ?>[/B]"><\/scr'+'ipt>' );
</script>
<noscript><img src='http://hits.affiliatetraction.com/cgi-bin/convert?offer=4656&amount=[B]<?php echo $order_summary['commissionable_order'];?>[/B]&uid=[B]<?php echo $order_summary['order_number'];?>[/B]' border=0 width=1 height=1></noscript>
<!-- Payne-Mason Tag Ends Here -->
  1. Save the changes.

  2. Using your FTP program, connect to your website and open the /includes/templates/ folder.

  3. If it doesn't already exist, create the NAME_OF_YOUR_CUSTOM_TEMPLATE_FOLDER folder, like step 2 above.

  4. Under that, create a new folder named checkout_success, like step 3 above.

  5. Now, using your FTP program, upload from your PC the /includes/template/NAME_OF_YOUR_CUSTOM_TEMPLATE_FOLDER/checkout_success/tpl_footer.php file to that folder on your server.

  6. Test it out.

  7. Pour yourself a coffee and study the FAQ articles on the template-override system to get a better understanding of the NAME_OF_YOUR_CUSTOM_TEMPLATE_FOLDER folder and the concept of overrides.

Donations gratefully accepted to the Zen Cart project here: http://www.zen-cart.com/index.php?main_page=infopages&pages_id=14

14 Nov 2008, 3:51 AM
#14
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

Will do Doc. On my way to Starbuks right now... Thanks for your help! I will post my results once I make it happen?!

15 Nov 2008, 12:05 AM
#15
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

So I have figured it out by placing javascript tags to open and close the code in the tpl_footer.php file, still using the [TAGS], it is tracking it now... just that I cannot find the correct tag to use so that it reads the subtotal and transaction ID, any ideas on what those are?

It won't track if I use this:

<?php echo $order_summary['commissionable_order']; ?>

it does track with the affiliate software if I just use the [ ], it just won't give me any Transaction ID or Dollar Ammount

15 Nov 2008, 7:18 AM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where to put my Affiliate Tracking Code??

Seems very odd. Maybe the affiliate script you're using wants the [ and ] wrapped around the <?php ..... ?> tags, like this:
[<?php echo ...... ?>]

15 Nov 2008, 8:05 PM
#17
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

So, it is not the [..] tags because when I just put text like: UNIQUE TRANSACTION ID in place of [UNIQUE TRANSACTION ID] and send an order through the affiliate link, this is what comes through our affiliate admin tool when I check on the order Transaction ID:UNIQUE TRANSACTION ID.(With the origional code and no php tags,the php tags make all the tracking info blank when I check it) So the [..] are nothing. And no matter what I put as the [DYNAMIC AMMOUNT] the Sale Ammount comes through as $0. I have tried it in every way reccomended. Good thing is that the tpl_footer is obviously communicating from the checkout_success page, just can't get the right TAGS that will communicate the order number and subtotal, is there a add-on module or some setting I am missing? Is there another reccomend that would help? Do I have to place these orders with a credit card to test correctly instead of check/money order? I didn't think so based on the fact that I would assume at least the order # would come through. When I try $order_id, it comes through as Trancation ID: $order_id. When I tried [$order_id] it came through as Transaction ID: [$order_id]. ???? I need your help so desperately! Thanks,

Dan

15 Nov 2008, 9:31 PM
#18
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

Right now I have it as your last reccomend for the code. Copy and pasted it in and it it bringing back blank transaction ID and $0.00 for sale ammount...

15 Nov 2008, 9:49 PM
#19
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: Where to put my Affiliate Tracking Code??

Here is my origional instructions:

Please place the following block of code on the post-transaction page of the offer.

To insure the accuracy of our reporting and billing, please replace the two values specified for amount and transaction identification with dynamic tags appropriate for your confirmation page. If either of these values are not available, or if your confirmation page is not dynamically generated, just leave them blank by removing the placeholders. The locations for these values is specified below as [DYNAMIC AMOUNT] and [UNIQUE TRANSACTION ID].

==============================

<!-- Payne-Mason Tag Begins Here --> <script language='Javascript'> document.write( '<scr'+'ipt language="Javascript" src="' ); if( document.location.toString().indexOf( 'https://' ) != -1 ){ document.write( 'https' ); } else { document.write( 'http' ); } document.write( '://hits.affiliatetraction.com/cgi-bin/convert?js=1&offer=4656&amount=[DYNAMIC AMOUNT]&uid=[UNIQUE TRANSACTION ID]"><\/scr'+'ipt>' ); </script>

<noscript><img src='http://hits.affiliatetraction.com/cgi-bin/convert?offer=4656&amount=[DYNAMIC AMOUNT]&uid=[UNIQUE TRANSACTION ID]' border=0 width=1 height=1></noscript>

<!-- Payne-Mason Tag Ends Here -->
15 Nov 2008, 10:44 PM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Where to put my Affiliate Tracking Code??

danwebman:

ZenCart: v1.3.7
Seems I missed the fact that you're talking about v1.3.7.
The specific variables I gave you are for 1.3.8, as a number of enhancements were added in that version to give better tracking capability.

For v1.3.7 you'll need:

$commissionable_order (for the amount)
$insert_id (for the order number)

You'd use them like this:

<?php echo $commissionable_order; ?> <?php echo $insert_id; ?>