{% 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="//{{ SENTRY_RAVEN_JS_URL }}"&gt;&lt;/script&gt;</pre>

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

<p>{% blocktrans %}Add 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 class="dsn">SENTRY_DSN</strong>{% endif %}', {
    // we highly recommend restricting exceptions to a domain in order to filter out clutter
    whitelistUrls: ['example.com/scripts/']
}).install();
&lt;/script&gt;</pre>

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

<pre>Raven.setUser({
    email: 'user@example.com',
    id: 'username'
});</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>
