A client-side conversion goal records a conversion when a contact visits a page on your website that contains the goal script. You can use it, for example, to measure a completed purchase, a resource download, or another action that is completed on a website page.
To correctly record and attribute conversions, your website must use a magnews web property.
Check the web property
Before configuring the goal, make sure you have an active web property with the option to track conversions enabled.
The web property code must be installed on your website. It allows magnews to recognize browsing activity and, when possible, associate actions with the visitor, the contact, and the assets they interacted with.
For more information, see the guide on configuring a web property.
Create the client-side goal
Open Conversion goals and create a new Client-side goal.
In the Goal tab, configure:
- Name: the name used to identify the goal in magnews.
- Goal ID: the identifier used in the script to specify which goal should record the conversion.
- Conversion type: indicates the type of action you want to measure, such as a purchase.
- The goal has a value: enable this option if you want to associate a monetary value with conversions, then select the currency.
- Hide the goal and its conversions from reports: enable this option if you do not want the goal to appear in reports.
Add parameters
In the Parameters tab, you can add information to collect along with the conversion, such as the category associated with the action.
You can choose from the available parameters that you created earlier. These are optional, but they allow you to analyze additional information about conversions in reports.
If you add them while configuring the goal, magnews automatically prepares the tracking code with the selected parameters already included.
Add the conversion script to your website
After saving the goal, select Add the code to your website from the goal home page.
magnews generates the script used to record conversions for the goal. If you configured a value or parameters, they are already included in the code.
Add the script only to the pages where a visit should be counted as a conversion. For example, to record a purchase, you can add it to the order confirmation page.
Script for conversion tracking
The conversion script must run after the web property code.
<script>
mna('conversion', {'goal': 'ecommercepurchase', value: '0.0'});
</script> In the generated code:
-
goalidentifies the conversion goal (in the exampleecommercepurchaseis the goal ID). -
valuecontains the conversion value, if applicable. If the monetary value changes from one conversion to another, for example based on the order total, the value passed to the script must match the value of the conversion being recorded. - Any parameters configured for the goal are added to the script and can be populated with information about the individual conversion.
Client-side tracking also depends on the cookie settings that the contact or visitor applies to your site.
View conversions and reports
From the goal home page, you can review its configuration, view the main data collected, and open the Report to analyze conversions.
From here, you can also:
- Edit the goal configuration.
- Review the associated parameters.
- Check whether the goal is visible in reports.
- Open Add the code to your website again to retrieve the updated script.