Adding Conversion Tracking without <script> tags



Trying to embed our pixels in Launchrock, and to do so we need to be able to plug the code into the Javascript section of the advanced editor.

In this area, something like the GA code snippet syntax works perfectly:

// Google Analytics
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
ga('create', 'UA-XXX-X', 'auto');

We don’t know anything about JS. How can we change our conversion tracking snippet into a similar function?

<script src="//" type="text/javascript"></script>
<script type="text/javascript">
<img height="1" width="1" style="display:none;" alt="" src="" />
<img height="1" width="1" style="display:none;" alt="" src="//" /></noscript>

Put the code straight into a, what, jQuery or regular JS syntax, in other words? No script tags.

Sorry if I sound like a complete buffoon, lol.




You can load a script asynchronously through jQuery’s getScript function then log the conversion.


You would miss the image-based trackers included on the page when no JavaScript is available. If you have a way to add the code in between the <noscript> elements on the page you will have better coverage.


Hi Niall,

Thanks for that!

Here’s what we’ve added:

// Twitter Conversion Tracking

container.append('<img height="1" width="1" style="display:none;" alt="" src="" />'); // Twitter pixel

container.append('<img height="1" width="1" style="display:none;" alt="" src="//" />'); // Twitter pixel

Our panel was saying we were tracking prior to adding the script, just by appending the pixels?

Is simply adding the pixels as we’ve done all that’s required?

From what you’ve said it sounds like the pixels are the fallback in a no JS environment. So what’s the advantage of the JS?

Thanks, will followup with our test results using your snippet!



The img elements should be wrapped in a noscript. They are not needed when JavaScript is available on the page.

closed #5