Skip to main content

Campaign Custom Goals

Charley Bader avatar
Written by Charley Bader
Updated this week

You are able to create custom goals to be used within the Campaign Manager for whether a user has visited a specific page, or clicked a specific element within your campaign.

For example;

  • If you are running an email sign-up experience, you may wish to track interactions with the sign-up CTA

  • If you are running an experience to encourage customers to go back to their basket, you may wish to track visits to the cart page

Setting Up Custom Goals

Custom goals are set-up by navigating to the area within the platform underneath the Campaign navigation item.

From here, select 'Create Custom Goal'. You can then give your goal a name.

Then choose the goal action: Visited Page or Clicked Element.

If your goal is Visited Page, you will then need to add the Page URL criteria of that specific page.

If your goal is Clicked Element, you can then choose either Element Class, ID, Tree, Text or XPath to identify to element you wish to track. You can find out more about these below:

Tracking Clicks

When a user clicks an element on the page, there are a number of ways to target that element in custom goals. Note that clicks are registered directly on the element that was clicked and do not bubble up to elements higher in the node tree. In this case, the contains operator is your friend. To target regions or collections of elements, we recommend targeting Element Tree contains element-or-id-class-name.

  • Element Class
    An element class is a name used to label elements in the page’s code, and the same class can be shared by multiple elements. To find it, right-click the element on your site, select Inspect, and look for class="..." in the highlighted code.

    Paste only the class name, for example add-to-cart. The class must uniquely identify the element, otherwise multiple elements may be tracked

  • Element Tree
    The element tree identifies an element by where it sits within the page structure. To find it, right-click the element, choose Inspect, and look at the chain of elements shown above it in the DOM. From this tree, copy one class name or ID only that uniquely identifies the element, for example product-card.

    Paste that single value into the field, for example:
    Element tree - contains - product-card

    The value must appear only once in the element tree, otherwise multiple elements may be tracked. Do not paste multiple values or the full tree path

  • Element ID
    An element ID is a unique name assigned to a single element on the page. To find it, right-click the element, click Inspect, and look for id="..." in the code.

    Paste only the ID value, for example checkout-submit. An ID should appear only once on the page to avoid tracking the wrong element

  • Element Text
    Element text is the visible text shown inside an element. To find it, right-click the element, select Inspect, and locate the text between the opening and closing tags.

    Example:
    <h1 class="title">Product title</h1>

    Paste only the text itself, such as Product title. The text must be unique and consistent, otherwise multiple elements may be tracked.

  • XPath
    XPath it is a flexible way to identify different elements of a web page. To find it, right-click the element, select Inspect, and locate the outermost element you want to target and then right clicking on that element and choosing Copy > Copy XPath

    Example: //*[@id="firstFocusableElement"]/cx-page-layout/cx-page-slot[1]/app-custom-paragraph[1]/div/div/div/div[6]

  • Data Attributes
    Data attributes are attributes given to elements to help us identify them.

    Example: <button data-id="some-element"> has a data-id of "some-element"

    These data attributes are captured when users interact with them, so you can use the data attribute value to target an element in a custom goal

Once done, then just hit Save!

Seeing Goals in Custom Reporting

Custom goals will automatically be available in all Campaign Reporting underneath Campaign Goal. You simply need to choose the correct one from the drop down

Did this answer your question?