(Optional) Additional Events
fireCustomGoal
fireCustomGoal
Sends an event to Northbeam indicating that a custom goal has happened. This helps you track and analyze milestones unique to your customers' journeys.
Examples:
- custom quote form fills
- SMS signups
- add-to-cart events
Note: if you'd like to track a new custom goal, please get in touch with the Northbeam team and share the names of your custom goals so they can be recognized in the Northbeam system.
window.Northbeam.fireCustomGoal("add_to_cart", {})
Argument | Type | Description | |
---|---|---|---|
1 | required | String | The name of the custom goal. Please email [email protected] with this name. |
2 | optional | Object | The total amount collected for the purchase. |
fireEmailCaptureEvent
fireEmailCaptureEvent
Sends an event to Northbeam indicating that a user has signed up for something with their email address.
Note: if you fire an email capture event, there is no need to call identify
- fireEmailCaptureEvent
implicitly does an identify()
call in the backend.
window.Northbeam.fireEmailCaptureEvent("[email protected]", "klaviyo_footer")
Argument | Type | Description | |
---|---|---|---|
1 | required | String | The email address |
2 | String | The location identifier describing where the email was captured. |
identify
identify
Identifies the current user with a particular real-world identifier. Better enables Northbeam to understand cross-device activity.
Currently only works with email addresses.
window.Northbeam.identify("email", "[email protected]")
Argument | Type | Description | |
---|---|---|---|
1 | required | String | The string "email" |
2 | required | String | The email address |
trackPageView
trackPageView
If your website uses JavaScript based routing, use this method to track transitions with pages.
window.Northbeam.trackPageView()
React Router Example
If you're using React Router, call this method after a page transition to track the change to a new location. (https://reactrouter.com/en/main/hooks/use-location)
import * as React from 'react';
import { useLocation } from 'react-router-dom';
function App() {
let location = useLocation();
React.useEffect(() => {
window.Northbeam.trackPageView();
}, [location]);
return (
// ...
);
}
Add a onload callback function for the Northbeam Pixel (onNorthbeamLoad
)
onNorthbeamLoad
)If you want to perform a Northbeam action on your site before the pixel has been loaded (e.g. if you want to do something as soon as your page loads instead of waiting on user action to kick it off), you can use this method to make sure we do what you need done as soon as our pixel is loaded.
<script type="text/javascript">
const func = () => {
// get args
window.Northbeam.firePurchaseEvent(args)
}
if(window.Northbeam){
// if Northbeam is already loaded, just call the
// firePurchaseEvent function
func()
}else{
// If Northbeam is not loaded, save your function
// in window.onNorthbeamLoad, so the pixel will call
// it as soon as window.Northbeam is defined.
window.onNorthbeamLoad = func
}
</script>
Updated about 2 months ago