How to add affiliate java script code in thank you page?

  • Profile Image
    usre
    Asked on June 16, 2017 at 04:30 AM

    Dear support!

    I would like to have a thank you page, which is shown after submitting a form like

    https://form.jotformeu.com/71662081278358

     

    For tracking of an affiliate network, this thank you page shold execute this script (example code)

    -----------------------------------------------------------------------------------------------------------------

    <script>

    (function (w, d, namespace, domain, progId, tagId, undefined) {

    w[namespace] = w[namespace] || {}; var act = w[namespace], payload = [];

    act.tags = act.tags || []; act.tags.push(tagId, payload);

    var protocol = d.location.protocol;

    payload.push({

    // Start: fixed parameters – don’t change!

    module: 'OrderTracking',

    event: 'Lead',

    // End: fixed parameters

    // Start: mandatory payload parameters – please edit

    order_id: 'AE25125346532',

    rate_number: 3,

    // End: mandatory payload parameters

    // Start: optional payload parameters – please edit

    currency: 'EUR',

    lmulti: 4,

    net_price: 0.42,

    order_description: 'test_order_123',

    product_ids: ['product1', 'product2', 'product3'],

    program_subid1: 'advertiser_subid_1',

    program_subid2: 'advertiser_subid_2',

    voucher_code: 'test_vouchercode',

    // Start: parameters for server sided tracking only

    ad_number: 6,

    ad_type: 4,

    click_time: '2014-10-05T11:13:01',

    date_format: 'yyyy-MM-ddTHH:mm:ss',

    order_date: '2014-11-03T18:12:13',

    publisher_id: 123,

    publisher_subid: 'test_subid',

    time_zone: '+1',

    uid: '1657A2C9-6764-4BF8-B5DE-5B2D1FFC1631'

    // End: optional payload parameters

    });

    if (act.get === undefined) {

    var s = d.createElement('script');

    s.type = 'text/javascript';

    s.src = protocol + '//' + domain + '/' + 'affadvc.aspx?ns=' +

    namespace + '&dm=' + domain + '&site=' + progId + '&tag=' + tagId;

    s.async = false; // always keep false for OrderTracking

    (d.getElementsByTagName('body')[0] ||

    d.getElementsByTagName('head')[0]).appendChild(s);

    }else { act.get(w, d, progId, tagId); }

    })(window, document,

    // Start: configuration parameters

    'aff_act_1.0', 'webmasterplan.com', PROGRAMID, 'TAG-ID-1');

    // End: configuration parameters

    </script>

    <noscript>

    <img src="https://partners.webmasterplan.com/

    TrackOrder.aspx?site=PROGRAMID&publisher_id=123&event=lead&lmulti=4&Curr

    ency=EUR&order_id=25125346532&order_description=test_order_123&order_date=2014-

    11-03T18:12:13&date_format=yyyy-MM-ddTHH:mm:ss&time_zone=-

    1&rate_number=3&ad_type=4&ad_number=6&publisher_subid=test_subid&program_subid1

    =advertiser_subid_1&program_subid2=advertiser_subid_2&voucher_code=test_voucher

    code&product_ids=product1,product2,product3&click_time=2014-10-

    05T11:13:01&uid=1657A2C9-6764-4BF8-B5DE-5B2D1FFC1631&net_price=0.42" />

    </noscript>

     

    -----------------------------------------------------------------------------------------------------------------

     

    I've copied this script to my thank you page at https://form.jotformeu.com/71662081278358,

    but the javascript is discarded immediately and I can't find the noscript code in the thank you page

    (after submitting and displaying the source code of the thank you page)

     

    Can you please help?

    Thanks a lot!

    Reinhard

  • Profile Image
    ashwin_d
    Answered on June 16, 2017 at 05:06 AM

    Hello usre,

    Please note that for security reasons, it is not possible to add any scripting code in form or thank you message. If you add any script code in form, it will be deleted immediately. 

    The best way to achieve your requirement is to create a new page in your website, add your script code in that page. You can use this as the thank you page URL of your JotForm. You may like to take a look at the following guide on how to redirect users to your own page:  https://www.jotform.com/help/38-Redirecting-Users-to-a-Different-Page

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!