Integration with Wordpress

Wordpress integration is not much different than Pure JavaScript integration. You only need to add Metricalp script to your Wordpress theme's header.php file. You can find it in your Wordpress admin panel / Appearance / Theme Editor / header.php. You can add Metricalp script to the end of your header.php file.

But for more convinent way, you can add it with Head & Footer Code Plugi.n

Install the plugin:

- In Wordpress website dashboard navigate to Plugins

- Click "Add New Plugin" button

- Search the "Head & Footer Code" in the plugin search bar.

- Click “Install Now” button just next to the "Head & Footer Code" plugin (which by Aleksandar Urošević).

- When it has installed, activate it via clicking "Activate"

Wordpress Plugin

Add Metricalp script:

- In the WordPress website dashboard, go to "Tools" and then "Head & Footer Code"

- In the "Site-wide head, body and footer code" section, paste the Metricalp embed script to HEAD Code field as described in Pure JavaScript Embed

html
<script src="https://cdn.metricalp.com/event/metricalp.js" data-allow-localhost="true" data-tid="YOUR_TID" defer></script>

- Do not forget to change YOUR_TID with your tid number a.k.a Tracker ID as described in Embed Share Tracker

- Click Save Changes in the bottom to apply the changes

Wordpress Plugin

That's all, you integrated your website with Metricalp, hooray 🚀

Defaultly, Metricalp automatically starts to collecting screen_view events (it can be disabled with data-disable-auto-route-catch option please check API reference for details and all other customizations). But if you want to fire an event manually (screen_view or any custom event), you can use window.metricalp.event function or custom data attributes. You will learn more about this in Custom Event & Props