Question about tracking code

Please could someone advise me if I can put both the javascript and image tracking codes in a single page?

In my javascript code, I have the following line:

and the image tracking code is almost the same but with &rec=1 in the middle of it:

If I use both codes, do I need to use both snippets above or can I leave the first one out? I’m not sure what these do.

The first one is inactive by default and you can enable it by adding Recording flag to 1 &rec=1

Many thanks for your help, Matt.