I am working with custom dimensions to track my website. I have a content based website. I want to track from which publisher my tracking is coming so I have developed something which uses parameters in my url for eg. www.xyz.com?code=UNIQUECODE
this unique code Tells me which publishers link redirected to my page. I run this UNIQUECODE through my database and send the id of the publisher associated with it using tag manager to my custom dimension i.e. PUBLISHER.
now I dont want to register another pageview for that particular publisher if the user refreshes or after a session ends.
what should be the scope of my custom dimension which persists the ID and not record another uniquePageview even if session ends.
If I understand your aim correctly I don't think any of the available scopes will provide exactly what you are after. Essentially the scope options process the last value in the session but you want to process the first value in the session.
I think you would have to use hit-level scope because that is the only way to ensure the first value persists in reporting.