{% load i18n %}

<p>{% blocktrans with 'https://github.com/getsentry/raven-js' as link %}Start by installing <a href="{{ link }}">raven-js</a>.{% endblocktrans %}</p>

<pre>&lt;script src="//{{ raven_js_url }}"&gt;&lt;/script&gt;</pre>

{% url 'sentry-manage-project' project.team.slug project.slug as project_link %}

<p>{% blocktrans %}Add the any URLs which will be logging errors in your project's settings under <a href="{{ project_link }}#client-security">Client Security</a>:{% endblocktrans %}</p>

<div class="image"><img src="{% url 'sentry-media' "sentry" "images/client_security.png" %}"></div>

<p>{% trans "Configure the client:" %}</p>

<pre>&lt;script&gt;
Raven.config('{% if dsn_public %}{{ dsn_public }}{% else %}<strong>SENTRY_DSN</strong>{% endif %}', {
    # we highly recommend restricting exceptions to a domain in order to filter out clutter
    whitelistUrls: [/example\.com/]
}).install();
&lt;/script&gt;</pre>

<p>{% trans "Add additional user context if it's available:" %}</p>

<pre>Raven.setUser({
    email: '&lt;?php echo $_SESSION['email'] ?&gt;',
    id: '&lt;?php echo $_SESSION['id'] ?&gt;'
});</pre>

<p>{% trans "Now call out to the raven client to capture events:" %}</p>

<pre>
// {% trans "record a simple message" %}
Raven.captureMessage('hello world!')

// {% trans "capture an exception" %}
try {
    errorThrowingCode();
} catch(err) {
    Raven.captureException(err);
}</pre>

<p>{% blocktrans with 'http://raven-js.readthedocs.org/' as link %}For more information on other uses of Raven with Javascript, please see the <a href="{{ link }}">official documentation for raven-js</a>.{% endblocktrans %}</p>
