蜜豆视频

Conversion Script for Custom Events conversion-script-for-custom-events

You define the fulfillment goal when creating a referral offer. If the action that counts towards the goal is a specific event on your own web page, you can use a conversion script to call our JavaScript API.

IMPORTANT
On July 31, 2024, we began the process of deprecating this feature. New assets can no longer be created. Existing assets will continue to work through January 31, 2025.

Retrieve the Conversion Script retrieve-the-conversion-script

  1. Within the referral offer editor, click Offer Details and then select Customer JavaScript Event from the fulfillment goal drop-down.

  2. Copy the top script in the grey box and place it on your webpage within the <body> tags. The bottom script is placed within the <header> tags.

    note note
    NOTE
    Remember to copy and paste both scripts if they are going on a non-Marketo website.

Retrieve the Loader Script retrieve-the-loader-script

  1. Select the referral offer from the tree, then click Referral Offer Actions and Embed Code.

  2. Right-click the Header Code and insert it into your webpage header. Then do the same for the Body Code.

Pasting the Scripts Onto Your Webpage pasting-the-scripts-onto-your-webpage

Paste the conversion scripts into the HTML for the body and header. Next, place the loader scripts into the HTML for the body and header.

Connecting the Conversion Script connecting-the-conversion-script

Here鈥檚 where you will write a JavaScript function that uses the specific HTML id of whatever page element you want to trigger goal completion on. For example:

<pre><em><!-- Referral offer conversion script --></em> <script> cf_scripts.afterload(function (){ jQuery("#myButtonId").click(function (){ CF.insight.conversion(); }); }); </script></pre> <pre>

In this example there is a button on the webpage with an id of 鈥#myButtonId.鈥 When that button is clicked, the person will be registered as having completed the goal.

Awesome! Your website is now capturing custom social promotion goals with Marketo.

recommendation-more-help
94ec3174-1d6c-4f51-822d-5424bedeecac