# Where to best place tracking code for the rss feed?

**URL:** <https://community.podlove.org/t/where-to-best-place-tracking-code-for-the-rss-feed/464>\
**Category:** Podlove Publisher\
**Created:** [December 8, 2015, 2:05pm UTC](https://community.podlove.org/t/where-to-best-place-tracking-code-for-the-rss-feed/464 "2015-12-08T14:05:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![test](https://community.podlove.org/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@test](https://community.podlove.org/u/test)\
**Post date:** [December 8, 2015, 2:05pm UTC](https://community.podlove.org/t/where-to-best-place-tracking-code-for-the-rss-feed/464/1 "2015-12-08T14:05:01Z")

</div>

Hi,  
besides the podlove analytics i need piwik tracking for the rss feed. I placed the tracking code in the “feed-rss2.php” template, which works fine, but is not update save. Any idea where I can place the tracking code without loosing it with the next update?

Best,  
Marc

---

<div class="post-metadata">

**Author:** ![timpritlove](https://community.podlove.org/user_avatar/community.podlove.org/timpritlove/32/1930_2.png) [@timpritlove](https://community.podlove.org/u/timpritlove)\
**Post date:** [December 8, 2015, 2:07pm UTC](https://community.podlove.org/t/where-to-best-place-tracking-code-for-the-rss-feed/464/2 "2015-12-08T14:07:19Z")

</div>

Can you describe what exactly you mean by “tracking code”, give an example and describe how you want this to work?

---

<div class="post-metadata">

**Author:** ![test](https://community.podlove.org/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@test](https://community.podlove.org/u/test)\
**Post date:** [December 8, 2015, 2:35pm UTC](https://community.podlove.org/t/where-to-best-place-tracking-code-for-the-rss-feed/464/3 "2015-12-08T14:35:10Z")

</div>

Well, that’s the code:

\<?php require\_once "../piwik/PiwikTracker.php"; PiwikTracker::$URL = 'http://myurl.com/piwik'; $t = new PiwikTracker( $idSite = 4 ); $t-\>setTokenAuth('xxx'); $t-\>doTrackPageView('xxx'); $t-\>setIp($\_SERVER['REMOTE\_ADDR']); if(isset($\_SERVER['HTTP\_REFERER'])) $t-\>setUrl($\_SERVER['HTTP\_REFERER']); I placed it in the feed-rss2.php template. Works fine. But will be overridden with the next update. Any idea how to place it without loosing the changes?

---

<div class="post-metadata">

**Author:** ![timpritlove](https://community.podlove.org/user_avatar/community.podlove.org/timpritlove/32/1930_2.png) [@timpritlove](https://community.podlove.org/u/timpritlove)\
**Post date:** [December 8, 2015, 3:21pm UTC](https://community.podlove.org/t/where-to-best-place-tracking-code-for-the-rss-feed/464/4 "2015-12-08T15:21:02Z")

</div>

If you want to survive updates you should implement this as a WordPress plugin.

But this is all about WordPress and has nothing to do with Podlove.
