# EPN Smart Links

**URL:** https://meta.discourse.org/t/epn-smart-links/116293
**Category:** Support
**Created:** [April 29, 2019, 9:15pm UTC](https://meta.discourse.org/t/epn-smart-links/116293 "2019-04-29T21:15:12Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![agentpoyo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/agentpoyo/32/139542_2.png) [@agentpoyo](https://meta.discourse.org/u/agentpoyo)
#### Post date: [April 29, 2019, 9:15pm UTC](https://meta.discourse.org/t/epn-smart-links/116293/1 "2019-04-29T21:15:12Z")

</div>

Seems when I attempt to add Smart Links that turn eBay links into rover .ebay. com affiliate links, it’s stripping out the script code with the campaign id that is essential to building the link.

```plaintext
<script>window._epn = {campaign:XXXXXXXXXX};</script>
<script src="https://epnt.ebay.com/static/epn-smart-tools.js"></script>

```

I add this to the theme’s header but it seems after saving and viewing the page source, the first line of the script is completely wiped away:

```plaintext
<script>window._epn = {campaign:XXXXXXXXXX};</script>

```

If I comment the tag out with it shows up in the source code.

Am I missing something? This code works fine on Wordpress and other sites. What would cause this to get stripped which I believe is the cause in ebay links not turning into affiliate rover ebay com links.

Thanks for any insight or suggestions.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 29, 2019, 9:47pm UTC](https://meta.discourse.org/t/epn-smart-links/116293/2 "2019-04-29T21:47:44Z")

</div>

Are you adding those snippets to the theme `</head>` area? Also, did you add this script URL to the [CSP site setting](https://meta.discourse.org/t/mitigate-xss-attacks-with-content-security-policy/104243) ?

---

<div class="post-metadata">

### Author: ![agentpoyo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/agentpoyo/32/139542_2.png) [@agentpoyo](https://meta.discourse.org/u/agentpoyo)
#### Post date: [April 29, 2019, 9:55pm UTC](https://meta.discourse.org/t/epn-smart-links/116293/3 "2019-04-29T21:55:13Z")

</div>

Yes I’ve added to the /head setting.

Right now this is on a test instance so all CSP is disabled.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 29, 2019, 9:57pm UTC](https://meta.discourse.org/t/epn-smart-links/116293/4 "2019-04-29T21:57:31Z")

</div>

That line should be extracted into a theme file, since inline Javascript is not allowed in recent versions of Discourse (for CSP). Did you check all theme JavaScript files too?

---

<div class="post-metadata">

### Author: ![agentpoyo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/agentpoyo/32/139542_2.png) [@agentpoyo](https://meta.discourse.org/u/agentpoyo)
#### Post date: [April 29, 2019, 10:02pm UTC](https://meta.discourse.org/t/epn-smart-links/116293/5 "2019-04-29T22:02:18Z")

</div>

That might be it then if I need to add that line to the theme. I take it I’ll have to add outside of the theme customization administration into the themed files? Where would I do that exactly, within the container itself on the flat files or code? Right now I’m just testing with the default Light theme. Thanks.

---

<div class="post-metadata">

### Author: ![agentpoyo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/agentpoyo/32/139542_2.png) [@agentpoyo](https://meta.discourse.org/u/agentpoyo)
#### Post date: [April 29, 2019, 11:30pm UTC](https://meta.discourse.org/t/epn-smart-links/116293/6 "2019-04-29T23:30:21Z")

</div>

> [@Falco](#):
>
> That line should be extracted into a theme file, since inline Javascript is not allowed in recent versions of Discourse (for CSP). Did you check all theme JavaScript files too?

After reading your reply again, this doesn’t make sense if I’ve disabled CSP entirely. So by disabling CSP and it’s still blocking inline scripts, that tells me it’s not entirely disabling CSP. Or am I missing something?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 29, 2019, 11:48pm UTC](https://meta.discourse.org/t/epn-smart-links/116293/7 "2019-04-29T23:48:51Z")

</div>

We put all JS into files, because makes no sense for us to not do it, since CSP is a default in all sites out of the box.

---

<div class="post-metadata">

### Author: ![agentpoyo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/agentpoyo/32/139542_2.png) [@agentpoyo](https://meta.discourse.org/u/agentpoyo)
#### Post date: [April 29, 2019, 11:55pm UTC](https://meta.discourse.org/t/epn-smart-links/116293/8 "2019-04-29T23:55:43Z")

</div>

Okay, that makes sense but doesn’t make sense if one disables CSP but yet it’s still enabled from what you’ve told me.

So do I need to create a new public/javascripts file with this bit of the code and have it load from there as something like:

```plaintext
<script src="epn_links.js"></script>

```

You’ll have to excuse my newbiness. I’m not a developer, just trying to setup a Discourse site that enables EPN links so any ebay links turn into affiliated links.

---

<div class="post-metadata">

### Author: ![devzero](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@devzero](https://meta.discourse.org/u/devzero)
#### Post date: [June 25, 2019, 6:06am UTC](https://meta.discourse.org/t/epn-smart-links/116293/9 "2019-06-25T06:06:35Z")

</div>

There are a lot of people having trouble activating adsense because of this block on inline scripts. Is there a good way around it?

For instance:

[https://meta.discourse.org/t/adsense-responsive-ads/63991/14](https://meta.discourse.org/t/adsense-responsive-ads/63991/14)

> [@How to Add Google Auto Ads Code in \</head\>](https://meta.discourse.org/t/how-to-add-google-auto-ads-code-in-head/109672/4):
>
> I have tried it but only the first script of code is showing in the source not the second.

I’m not finding a way around this either.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [December 11, 2022, 9:47am UTC](https://meta.discourse.org/t/epn-smart-links/116293/10 "2022-12-11T09:47:51Z")

</div>


