Skip to content

Install measurement on your site

Placing the script is the only technical step in Pulsar. Here is the exact procedure for each environment, including those that hold surprises.

In short

Copy the two lines of script shown in your settings, paste them into the head of your pages, and measurement starts on the first visit. The same pair of lines works both for a direct install and through a tag manager.

The two lines to copy

Open your site in Pulsar, then Settings, Installation. The black box contains exactly what needs to be placed. Copy the whole thing: each line has its role, and leaving one out breaks certain installs.

  • The first line declares the configuration in a global variable and prepares the queue for custom events. It loads nothing.
  • The second line loads the measurement script, asynchronously, with the same configuration repeated as data-* attributes.

The configuration is written twice on purpose, in the global variable and in the attributes. That is what makes the same pair of lines valid everywhere, including under a tag manager that strips attributes. Do not remove the line that looks redundant to you.

Direct placement in the HTML

This is the most reliable method, and the one to prefer whenever possible. The script depends on no intermediary, and nothing can delay or remove it.

  1. 1 Open the template that produces the <head> of all your pages.
  2. 2 Paste the two lines just before </head>.
  3. 3 Publish, then load a page of your site.
  4. 4 Go back to Settings, Installation and click Test: Pulsar tells you whether anything came in.

WordPress

Three routes, from the most durable to the quickest. The first survives theme updates, the others do not.

  • Through a code insertion plugin. WPCode, Header Footer Code Manager or similar. Paste the two lines into the header area, applied site-wide. This is the recommended route: nothing is lost when the theme is updated.
  • Through the theme settings. Many themes offer a « Header scripts » field in the customiser. Convenient, but the content belongs to the theme: changing theme erases the script.
  • Through the header.php file. Only in a child theme. In a parent theme, the next update will overwrite your change without warning.

If your site uses caching, clear it after placing the script. A page served from cache keeps its old HTML, without the script, and you will wrongly conclude that the install failed.

Google Tag Manager, in detail

GTM works, but requires a precaution that nothing warns you about. The container injects external scripts without copying their data-* attributes, and sets document.currentScript to null. A script reading its configuration from its attributes would therefore find nothing, and stay silent without any error.

That is precisely why the first line exists. By pasting both lines together, the configuration travels through the global variable and the install works.

  1. 1 In GTM, open Tags, then New.
  2. 2 Choose the Custom HTML type.
  3. 3 Paste both lines copied from your settings, unchanged.
  4. 4 Leave Support document.write unchecked: the script does not need it.
  5. 5 Trigger: All Pages, of the Page View type. Pick the earliest initialisation available so you do not lose visitors who leave straight away.
  6. 6 Name the tag, save, then publish the container. A tag that is saved but not published does nothing.
  7. 7 Check in Preview mode: the tag must show as fired, and the Network tab must show a call to the collection domain.

Installing through GTM adds a dependency: if a visitor blocks the container, they block your measurement too. Blockers target GTM far more often than Pulsar. On a technical audience, the gap with a direct install commonly reaches fifteen per cent.

Shopify

  1. 1 From the admin, open Online Store, Themes, then Edit code on the active theme.
  2. 2 Open layout/theme.liquid.
  3. 3 Paste the two lines just before </head>.
  4. 4 Save: Shopify publishes immediately.

Shopify's checkout is served from separate pages, to which this file does not apply. Checkout pages will therefore not be measured, except on plans that allow scripts in the checkout.

Webflow, Wix, Squarespace

  • Webflow: Project settings, Custom code tab, Head code field. Republish the site, custom code is not active in preview.
  • Wix: Settings, Tracking & Analytics, add a custom tool, scope All pages, placement Head.
  • Squarespace: Settings, Code injection, Header field. Available from the Business plans upwards.

Single-page apps: React, Vue, Next, Nuxt

Nothing special to do. The script watches navigation history, including pushState, replaceState and the back button: every view change is counted as a page view, with no call from you.

Place the two lines in the base HTML document: index.html for Vite, app/layout.tsx for Next using the Script component with the afterInteractive strategy, app.html for SvelteKit.

Do not call the pixel manually on every route change: you would count each view twice. History tracking is already in place.

Serving the script from your own domain

By default the script comes from Pulsar's collection domain. You can serve it from a subdomain of your own, for example stats.yoursite.com. It then stops being a third-party resource.

The benefit is twofold: it escapes the block lists that target analytics domains, and it reuses an already open connection, which recovers the page views lost on fast navigations. Depending on the audience, that represents between five and twenty per cent of visits.

The setting lives in Settings, Installation. The script then derives its collection address from its own origin: the two lines shown are updated automatically, you only have to copy them again.

Checking that everything works

The Test button in the settings queries collection and tells you whether data is arriving. That is the quickest check.

If in doubt, open your browser console, Network tab, and reload a page of your site. You should see a request to the collection domain, ending in /e.

  • No request at all. The script is not loaded: check that it really is in the served HTML, not only in your template.
  • Request blocked. A browser extension is filtering it. Test in private browsing with extensions disabled.
  • Request sent, no figures. Your IP address is probably in the account exclusions. This is the most common cause of « it doesn't work » when everything works.

Measuring a specific action

Once the script is in place, you can report an event from your code, for example when a form is submitted:

pulsar('quote_sent', { plan: 'pro' })

The call works even before the script has fully loaded: the first line of the snippet queues the calls, and the script processes them on arrival. You can therefore use it without worrying about order.

An event becomes a tracked conversion as soon as you mark it as a goal, with one click on the star in the dashboard.

Missing an answer? Write to us. We reply ourselves, and we complete this guide.

Ask a question