If you're adding a script to your school that expects dynamic (not hardcoded) values, then you'll use a Pathwright variable.

Here's an example of a Google Analytics script that expects the current user's ID. When this script is executed, PATHWRIGHT___AUTH___USER___ID will be replaced with the actual ID of the current user.

<script>
  ga('create', 'UA-XXXXX-Y', 'auto', {
    userId: PATHWRIGHT___AUTH___USER___ID
  });
</script>

Or, if you're a little more advanced, it may be even better to first check if PATHWRIGHT___AUTH___USER___ID exists.

<script>
  var data = {}

  if (PATHWRIGHT___AUTH___USER___ID) {
    data.userId = PATHWRIGHT___AUTH___USER___ID
  }

  ga('create', 'UA-XXXXX-Y', 'auto', data);
</script>

How to add custom scripts 

Open "Settings" from the main menu and go to Connect other apps > Add custom code & pixel tracking.

Account-wide variables

Below is a list of the variables that you can use within an embed code for account-wide header and footer scripts and for purchase confirmation screen scripts.

PATHWRIGHT___AUTH___USER___EMAIL: the user's email

PATHWRIGHT___AUTH___USER___ID: the user's ID

PATHWRIGHT___AUTH___USER___FIRST_NAME: the user's first name

PATHWRIGHT___AUTH___USER___LAST_NAME: the user's last name

PATHWRIGHT___REGISTER___SUBSCRIBED: "true" if the user subscribed in the process of registering for the course

Purchase confirmation variables

Below is a list of the variables that you can use within an embed code for purchase confirmation screen scripts.

PATHWRIGHT___REGISTER___REGISTRATION___TRANSACTION_ID: the unique ID for the transaction

PATHWRIGHT___REGISTER___REGISTRATION___DISCOUNT_APPLIED: the discount applied if any

PATHWRIGHT___REGISTER___REGISTRATION___COUPON_CODE: the coupon code applied if any

PATHWRIGHT___REGISTER___PRICE: the total price

PATHWRIGHT___REGISTER___OFFERING___ID: the ID of the group the user registered for

PATHWRIGHT___REGISTER___OFFERING___NAME: the name of the group the user registered for

PATHWRIGHT___REGISTER___RESOURCE___ID: the ID of the course the user registered for

PATHWRIGHT___REGISTER___RESOURCE___NAME: the name of the course the user registered for

The following are specific to accounts using our built-in subscription plans. 

PATHWRIGHT___SUBSCRIBE___SUBSCRIPTION___SCHOOL_PLAN___AMOUNT: the price of the subscription plan subscribed to by the user

PATHWRIGHT___SUBSCRIBE___SUBSCRIPTION___SCHOOL_PLAN___NAME: the name of the subscription plan subscribed to by the user

PATHWRIGHT___SUBSCRIBE___SUBSCRIPTION___SCHOOL_PLAN___ID: the ID of the subscription plan subscribed to by the user

PATHWRIGHT___REGISTER___SUBSCRIBED is a boolean and indicates that the user subscribed when they registered for a course.

PATHWRIGHT___SUBSCRIBE___SUBSCRIPTION___ID: the ID of the subscription plan used when a learner subscribed

PATHWRIGHT___SUBSCRIBE___COUPON___CODE: coupon code used when a learner subscribed

Did this answer your question?