{% load i18n %}
{% blocktrans with 'https://github.com/getsentry/raven-js' as link %}Start by installing raven-js.{% endblocktrans %}
<script src="//{{ raven_js_url }}"></script>
{% url 'sentry-manage-project' project.team.slug project.slug as project_link %}
{% blocktrans %}Add the any URLs which will be logging errors in your project's settings under Client Security:{% endblocktrans %}
{% trans "Configure the client:" %}
<script>
Raven.config('{% if dsn_public %}{{ dsn_public }}{% else %}SENTRY_DSN{% endif %}', {
# we highly recommend restricting exceptions to a domain in order to filter out clutter
whitelistUrls: [/example\.com/]
}).install();
</script>
{% trans "Add additional user context if it's available:" %}
Raven.setUser({
email: '<?php echo $_SESSION['email'] ?>',
id: '<?php echo $_SESSION['id'] ?>'
});
{% trans "Now call out to the raven client to capture events:" %}
// {% trans "record a simple message" %}
Raven.captureMessage('hello world!')
// {% trans "capture an exception" %}
try {
errorThrowingCode();
} catch(err) {
Raven.captureException(err);
}
{% blocktrans with 'http://raven-js.readthedocs.org/' as link %}For more information on other uses of Raven with Javascript, please see the official documentation for raven-js.{% endblocktrans %}