Developer forum

Forum » Swift » Visual editor and tracking

Visual editor and tracking

Suzi Louring
Suzi Louring
Reply

Hellooo

It would be nice, if the Swift master file didn't include tracking scripts when you're in visual editor mode.

For example, gtm.js is loaded if I have filled in "Google tag manager ID" in website settings -> Meta and API keys.

We already handle this with the IsVisualEditorMode page property, but we need to remember it every time.

Thanks :)
 

/Suzi

 

 

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Yes, great addition.

You can change this line: https://github.com/dynamicweb/Swift/blob/main/Files/Templates/Designs/Swift-v2/Swift-v2_Master.cshtml#L119

To this:

@if (!string.IsNullOrWhiteSpace(googleTagManagerID) && !Pageview.IsVisualEditorMode)

https://doc.dynamicweb.dev/documentation/fundamentals/dw10release/releasenotes/workiteminfo.html?workitemid=26201

Votes for this answer: 1
 
Suzi Louring
Suzi Louring
Reply

Thank you Nicolai - that's exactly what we already do :)
Ant it will also make backend faster :)

 

You must be logged in to post in the forum