Capturing 1ShoppingCart.com POST variables for Affiliate Tracking Pixels

9 replies
Hello,

I am trying to set up a tracking code from commission junction (CJ) to my hosted thank you page. CJ has provided me with an img script

Code:
<img src="domain.com?CID=111111&OID=orderID&TYPE=22222&ITEM1= Purchase&AMT1=Total>&QTY1=1&CURRENCY=USD&METHOD=IMG" height="1" width="20">
1shooping cart does provide post variables which to the 2 i need are OID=OrderID & AMT1=Total

The problem is that they do not provide support on how to grab those variables and pass them onto this img script??? They said to me that i need to "read it from the post array pull out the post" or something like that. How can i do that and can i do that from their hosted thank you page? I do see the script show up in the body of the thank you page, but it does not pass the variables i need. Can anyone please help?

Max
#1shoppingcartcom #affiliate #capturing #pixels #post #tracking #variables
  • Profile picture of the author Bruce Hearder
    Hi,

    First up I have never used CJ, but reading from your post, I might be able to offer some suggestions.

    Using a image to do tracking of traffic is a very common feature on the Internet. Basicall all they are doing is making a call to remote file (from inside an html <IMG> tag to pass parameters.

    So, how dowes this help you.

    You can create a PHP file on your server that reds the values passed from the IMG tag.

    Something like
    PHP Code:
    <?php
     $oid 
    $_GET['OID'];
     
    $atm1$_GET['ATM'];
     
    //////
     
    Now do something with these variablesit up to you
    ?>
    Save the file as tracking php

    Now in the place of domain.com, use www.yourdomain.com/tracking.php

    and then you can post the variables to where ever you want.

    Appologise for the very brief answer, but not being familiar with CJ or 1SC, its hard to comment in much more detail

    I hope this gets things heading in the write direction for you

    Bruce
    {{ DiscussionBoard.errors[3547311].message }}
    • Profile picture of the author PrimalF
      Thanks Bruce, but i wont be able to do it via php, because its a system hosted page. I need to pull the variables through javascript. I had a friend give me a code, but it still doesnt seem to work. Maybe somebody here can take a look at the code to see if there is something wrong?

      Here are the variables that show up in the source at the top of the html confirmation page. I believe this is where it needs to grab them.

      Code:
      //<![CDATA[
      var SecureCartOrders = [ {"orderID":18659842,"name":"Max Test","company":null,"email1":"max@maxtest.com","address1":"123 main st","address2":null,"city":"somewhere","state":"Florida","zip":"33333","country":"United States","fax":null,"phone":"5611112222","secondaryphone":null,"cardtype":"","shipname":"Max Test","shipCompany":null,"shipAddress1":"123 main st","shipAddress2":null,"shipCity":"west palm beach","shipState":"Florida","shipZip":"33405","shipCountry":"United States","status":"Accepted","product":["product name"],"sku":["fclo3243"],"quantity":[1],"price":[0.00],"option":[[]],"productattributes":[{}],"plist":"3598071","Total":0.00,"shippingMethod":"Free Shipping","shippingAmount":0,"grandTotal":0.00,"adtrack":0} ];
      //]]>
      Here is the javascript that was made to extract those variables to add to an img pixel. This is how commission junction gets the order confirmation.


      Code:
      <script type='text/javascript'> 
      var orderId = SecureCartOrders[0].orderID; 
      var subTotal = SecureCartOrders[0].Total;
      var url ='emjcddotcom/u?CID=1111111&TYPE=343555&CURRENCY=USD&METHOD=IMG';  ---this is a real link had to modify to post---
      url += '&OID=' + orderId;
      url += '&AMOUNT=' +subTotal; 
      document.write('<img width=\'20\' height=\'1\' src=\' + url + \'\'>'); 
      </script>
      Can someone explain this to me or let me know if this is supose to work?
      {{ DiscussionBoard.errors[3567463].message }}
      • Profile picture of the author RyanAndrews
        You can only get post variables server-side, PHP or similar.

        If you HAVE to send the data just before a form submit, you'd have to use AJAX. So rather than using document.write you'd GET the image using an AJAX call. That sounds rather complex, and you'd think they'd be more helpful with their product.
        {{ DiscussionBoard.errors[3567650].message }}
        • Profile picture of the author PrimalF
          Originally Posted by RyanAndrews View Post

          You can only get post variables server-side, PHP or similar.

          Thanks for your reply, they did mention i would have to get post variables server side. Im just not sure what they mean by that. They provide no support for 3rd party scripts even tho they have a section where i copy and paste the code.

          Does this mean that javascript would never work for this? How could i get this image tag to display and grab these variables? By the way 1shoppingcart is asp.
          {{ DiscussionBoard.errors[3567676].message }}
  • Profile picture of the author SteveJohnson
    You're talking about copy/pasting javascript, then you say it's a hosted thank-you page that you can't get to. Where are going to copy/paste the javascript to?

    Do you have any control over where 1SC redirects the buyer?
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[3568393].message }}
    • Profile picture of the author PrimalF
      yes i have control to add header/body or footer information into their system hosted thank you page. I added the code that you see into the body area.

      I can redirect the user to a custom thank you page link if i need to. But currently i dont use that option. I was told that i can add a 3rd party script and it should be able to extract the variables. but its not working.
      {{ DiscussionBoard.errors[3568457].message }}
  • Profile picture of the author SteveJohnson
    OK, gotcha.

    POST data isn't available from an HTML page, you can't extract it with javascript. 1SC POSTs the data to the script that builds the HTML thank-you page.

    If 1SC somehow adds the information to the HTML page (say, for instance, in hidden form fields), THEN you can get at it with javascript.

    The only way you're going to get to the 1SC POST data is to have 1SC send the buyer to your URL where you'll extract the data. From there, you can send them on to the hosted thankyou page, or construct one of your own.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[3568549].message }}
    • Profile picture of the author PrimalF
      ok yea, thats what i was starting to think. But why does the source show all of the variables that ineed within the source? For instance

      //<![CDATA[
      var SecureCartOrders = [ {"orderID"
      etc... etc..

      Arent they providing this to grab the variables?

      Do you think i need to send them to a domain.com/thankyou.aspx page to grab the data? I wouldnt be able to redirect them back to 1SC that would be the final page. So the question is, could i then grab that information even tho its going to another domain?
      {{ DiscussionBoard.errors[3568986].message }}
  • Profile picture of the author SteveJohnson
    Truthfully, I don't know why they're putting that data there. It's not accessible via javascript (as far as I know).

    I'm not a javascript whiz-kid, so I'm afraid that I'm at my limits of being able to help, sorry.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[3569348].message }}

Trending Topics