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

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

 

You must be logged in to post in the forum