# Firing an event for only one site ID

**URL:** <https://community.piwik.pro/t/firing-an-event-for-only-one-site-id/2266>\
**Category:** Data collection and tags\
**Created:** [May 19, 2023, 4:02pm UTC](https://community.piwik.pro/t/firing-an-event-for-only-one-site-id/2266 "2023-05-19T16:02:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![onderval](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/onderval/32/1323_2.png) [@onderval](https://community.piwik.pro/u/onderval)\
**Post date:** [May 19, 2023, 4:02pm UTC](https://community.piwik.pro/t/firing-an-event-for-only-one-site-id/2266/1 "2023-05-19T16:02:26Z")

</div>

I was implementing multiple sites in a single container; like this: [Multiple PiwikPro sites under a single container](https://community.piwik.pro/t/multiple-piwikpro-sites-under-a-single-container/1652)

Adding it this way is fine but I couldn’t find specific example in the documentation about what to do if I want to send an event or a page view to a single site ID only. As example, let’s say I wanted to set a custom dimension for only one of the site ids. The following script seems to work for me. Is this the correct approach?

```auto
<script>
	setTimeout(function() {
        _ppas.push(["setTrackerUrl", "https://examplesite.piwik.pro/ppms.php"]);
        _ppas.push(["setSiteId", "8b645e9f-f842-4f42-a986-abc123456789"]);
        _ppas.push(["setCustomDimensionValue", 1, "loginStatus"]);
  		_ppas.push(['setCustomUrl', {{ Page Url }}]);
  		_ppas.push(['setDocumentTitle', {{ Global - Document Title }}]);
 		_ppas.push(['trackPageView']);
	}, 1000);
</script>

```

---

<div class="post-metadata">

**Author:** ![anthonybartczak](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/anthonybartczak/32/2430_2.png) [@anthonybartczak](https://community.piwik.pro/u/anthonybartczak)\
**Post date:** [May 22, 2023, 6:02am UTC](https://community.piwik.pro/t/firing-an-event-for-only-one-site-id/2266/2 "2023-05-22T06:02:52Z")

</div>

Hi onderval!

I think it would be best to check the site ID this way:

```auto
_ppas.push([function () {
  if (this.getSiteId() === '8b645e9f-f842-4f42-a986-abc123456789') {
      this.setCustomDimensionValue(1, "loginStatus");
      }
 }])

```

Please let me know whether this works for you 🙂.
