Embed Conversion Tracking and Affiliate Tracking Codes On Sign Up Pages

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000009295-embed-conversion-tracking-and-affiliate-tracking-codes-on-sign-up-pages

There are many 3rd party tools that require placing a tracking code on "success pages" in order to track sales, sign-ups, conversions, and more. 


With Brilliant Directories, it is possible to place tracking code widget for the "success pages" into each membership plan or in a specific widget that will apply to all membership plans. 


Membership Plans Method


There is a setting on each membership plan where the widget with the code can be placed. 


It can be found under Finance >> Membership Plans >> find the membership where the code needs to be added and click on Edit




Navigate to the "Sign-Ups & Upgrades" tab and scroll down to "Sign Ups / Upgrade Conversion Tracking Code" and select the preferred widget:




*This allows the activation of an additional Tracking Code Widget that will work alongside the default Bootstrap Theme - Conversion Tracking Codeswhich will always remain active.



Conversion Tracking Codes Widget and Available Variables to Utilize


Navigate Toolbox >> Widget Manager >> Bootstrap Theme - Conversion Tracking Codes




An example conversion tracking to add could look like the following:

fbq('track', 'Purchase', {currency: "AUD", value: <?php echo $conversion_tracking['amount']; ?>});


This code should be added below the following comment within this widget:




When adding this code, please make sure to wrap it around the <script> tag, as shown below:


<script type="text/javascript">fbq('track', 'Purchase', {currency: "AUD", value: <?php echo $conversion_tracking['amount']; ?>});</script>

The end result would look like the following:




Some common variables that affiliates and other trackers want to be included in the pixel tracking code are the order amount and order or member ID, etc. These are the variables available with Brilliant Directories:


COMMON VARIABLES AFFILIATE TRACKERS USE:


  • FIRST PAYMENT AMOUNT = <?php echo $conversion_tracking['amount']; ?>
  • RECURRING PAYMENT AMOUNT = <?php echo $conversion_tracking['recurring_amount']; ?>
  • ORDER ID / MEMBER ID = <?php echo $conversion_tracking['user_id']; ?>
  • COUPON CODE = <?php echo $conversion_tracking['coupon_code']; ?>
  • PRODUCT NAME = <?php echo $conversion_tracking['product_name']; ?>
  • PRODUCT TYPE = <?php echo $conversion_tracking['product_type']; ?> 
  • FREE TRIAL = <?php echo $conversion_tracking['free_trial']; ?>
  • FREE TRIAL DAYS = <?php echo $conversion_tracking['free_trial_period']; ?> 
  • FIRST BILL DATE = <?php echo $conversion_tracking['first_bill_date']; ?> 


ADVANCED VARIABLES AFFILIATE TRACKERS USE:


  • $conversion_tracking['invoice']['variable'];    (Invoice Variables from the tblinvoices table)
  • $conversion_tracking['product']['variable'];   (Member Subscription Variables from the tblhosting table)



IMPORTANT NOTE:  This widget is where the tracking code for affiliate programs, analytics, and more can be placed.

This widget only loads on pages after a member sign-ups or upgrades, to track successful sign-ups. 


Alternative Method: Adding Conversion Tracking to Pop-Up Success Messages


If the conversion action does not load a separate success page (e.g., a pop-up message confirms success on the same page), the conversion tracking code can also be placed in the text label that appears after a successful action. This can be done by navigating the Text Label for the post-success message and embedding the tracking code there.


For this example, let's add a Google Ads conversion tracking setup for a newsletter subscriber pop-up. To accomplish this, first, navigate Toolbox >> Widget Manager and create a new widget:




Name the widget, add the tracking code in the HTML tab, and save the changes:




Then copy the PHP shortcode of the widget:




Next, place the copied shortcode of the widget to the text label:




Alternatively, the code can be inserted directly within the text label. However, we recommend using the widget method for more reliable performance and smoother processing.




The tracking code will now trigger each time a user subscribes to the newsletter.




This option is especially useful for scenarios where confirmation appears as inline text or a pop-up, rather than a new page. Be sure to use this method as an alternative in any scenario where a separate success page is not available.


NOTE: This method may not be optimal and might not work reliably if the script requires a specific loading sequence or is complex. However, it can be effective in many cases. Be sure to thoroughly test before finalizing any updates.