Expand my Community achievements bar.

SOLVED

How can DTM Switch access staging script without being on page

Avatar

Level 2

Hi there

I'm slightly confusing to how the staging library (via the DTM switch) can be accessed if it is not physically on that page. For all of my implementations I ask the devs to put staging on the test site and the prod one on the live site. In the real world, the flow of tag management isn't that simple as some clients only have a live site that I can work on.

For example, I only have the prod satellite script on the site but can preview changes in the staging mode. This may be a simple answer, but I can't seem to find it.

Another follow up to the confusion of this, is that I sometimes can't access the staging environment via the switch and I have to publish to see my changes, so the testing process is eradicated. Can someone shine some light on this, it would be much appreciated.

In summary

I have prod script, sometimes can preview staging changes, sometimes can't using DTM switch.

Many many thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

I've never had the switch not work personally. Not to say that couldn't happen. The switch plug-in is actually developed by a third-party so I can't be sure if maybe a certain version of Chrome isn't working with it or another script or framework is interfering.

Is there a URL you can share where this happens that I could test?

You should never have to publish an item to production to test something. If the DTM switch plug-in isn't working, you can always use a proxy like Charles to re-write the script tag on your local machine.

Also, there is a official Adobe extension being worked on that would provide another method of doing this. I don't have an ETA on when it will be available, but I'll be sure to make an announcement about it in the Dynamic Tag Management​ community and post about it on our Experience Care Twitter handle.

View solution in original post

5 Replies

Avatar

Level 10

Hi,

The DTM switch essentially just swaps out the production library with the staging library. It does this in the browser locally on your machine only. In order to use the switch, you need to load your webpage, flip the switch, then reload the page.

You can test if the staging or production code is being loaded on your page via the browser's console by using the "_satellite.settings.isStaging" function. This will return "true" if the staging library is loaded and "false" if the production library is loaded.

Hopefully this helps,

Jantzen

Avatar

Level 2

Hi Jantzen

Thanks very much for your reply, that's really helpful.

Just wondering why it wouldn't work sometimes though. I've had to publish to live from time to time to test because the staging library isn't being referenced (sometimes switch isn't available or reloading doesn't make a difference)

Many thanks

Phil

Avatar

Correct answer by
Level 10

I've never had the switch not work personally. Not to say that couldn't happen. The switch plug-in is actually developed by a third-party so I can't be sure if maybe a certain version of Chrome isn't working with it or another script or framework is interfering.

Is there a URL you can share where this happens that I could test?

You should never have to publish an item to production to test something. If the DTM switch plug-in isn't working, you can always use a proxy like Charles to re-write the script tag on your local machine.

Also, there is a official Adobe extension being worked on that would provide another method of doing this. I don't have an ETA on when it will be available, but I'll be sure to make an announcement about it in the Dynamic Tag Management​ community and post about it on our Experience Care Twitter handle.

Avatar

Level 2

HI Jantzen

I have a theory that it is because the DTM script is within a requirejs file and the switch isn't interacting correctly with it. I could be wrong, I have a developer helping me to see if that is the issue.

Many thanks for your explanation, it has been extremely helpful.

Thanks

Phil 

Avatar

Level 10

That could definitely be it. Anything outside of the recommended deployment could potentially cause issues. Be sure to report back here when you find if that is the case. Doing so will help others that might face the same issue.

Recommended deployment of DTM is to have the embed tag staticky included with the HTML inside the <head> tags and the closing embed tag placed just before the closing body tag. Deployments outside of this method can be done, but occasionally you may run into issues.