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.

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

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

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

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

Here’s 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.

On this page