title: Google Tag Manager (Firebase) Preview link iOS does not work - Deep Link does not contain valid required params
body: <p>We integrated Google Tag Manager and Firebase into our iOS app. Everything seems to be integrated correctly (app loads default and remotely defined container and sends events to Firebase, app is opened on preview QR code).</p>
  
  <p>But I have difficulties to use Preview feature on not published version.</p>
  
  <p>What I do:</p>
  
  <ol>
  <li>Currently published container version is 4.</li>
  <li>Then I changed the tag - saved changes as a version 5 and used preview feature, which generates begin preview QR Code link - url like <a href="https://tagmanager.google.com/mcpr/com.app.XXX?id=GTM-XXXXXX&amp;gtm_auth=7xxhnmjdIb71fZ28PDPmXg&amp;gtm_preview=5" rel="nofollow">https://tagmanager.google.com/mcpr/com.app.XXX?id=GTM-XXXXXX&amp;gtm_auth=7xxhnmjdIb71fZ28PDPmXg&amp;gtm_preview=5</a></li>
  <li>Then I opened app using QR code scan in the device and tried to invoke tag - old version 4 was invoked, but I expected that version 5 with different implementation should be used.</li>
  </ol>
  
  <p>Note: I know that version 4 was used, because my tag renames event name by adding suffix, which is different on version 4 and 5. What is tracked I can see in debug console.</p>
  
  <p>In the log I see:</p>
  
  <pre><code>&lt;FIRAnalytics/DEBUG&gt; Deep Link does not contain valid required params. URL     params: {
     "gtm_auth" = 7xxhnmjdIb71fZ28PDPmXg;
     "gtm_preview" = 5;
     id = "GTM-XXXXXX";
  }
  </code></pre>
  
  <p>This is my container definition (json) - version 5:</p>
  
  <pre><code>{
  
  "fingerprint":"NQ$0",
  
  "resource": {
    "version":"5",
    "macros":[
      {
        "function":"__e",
        "instance_name":"Event Name",
        "vendor_template_version":"1"
      },
      {
        "function":"__ai",
        "instance_name":"App ID",
        "vendor_template_version":"1"
      },
      {
        "function":"__an",
        "instance_name":"App Name",
        "vendor_template_version":"1"
      },
      {
        "function":"__av",
        "instance_name":"App Version Code",
        "vendor_template_version":"1"
      }
    ],
    "tags":[
      {
        "function":"__fm",
        "instance_name":"Firebase X Tag",
        "once_per_event":true,
        "vendor_template_version":"1",
        "vtp_overrideEventName":["template",["macro",0],"zz"],
        "vtp_action":"filter",
        "tag_id":2
      }
    ],
    "predicates":[
      {
        "function":"_sw",
        "arg0":["macro",0],
        "arg1":"test"
      }
    ],
    "rules":[
      [["if",0],["add",0]]
    ]
  },
  "runtime":
  [[50,"__ai_main",[46],[36,[2,[17,[15,"gtmUtils"],"mobile"],"applicationId",[7]]]],[50,"__ai",[46,"data"],[36,["__ai_main",[15,"data"]]]],
  [50,"__an_main",[46],[36,[2,[17,[15,"gtmUtils"],"mobile"],"applicationName",[7]]]],[50,"__an",[46,"data"],[36,["__an_main",[15,"data"]]]],
  [50,"__av_main",[46],[36,[2,[17,[15,"gtmUtils"],"mobile"],"applicationVersion",[7]]]],[50,"__av",[46,"data"],[36,["__av_main",[15,"data"]]]],
  [50,"__e_main",[46],[36,[2,[17,[15,"gtmUtils"],"mobile"],"event",[7]]]],[50,"__e",[46,"data"],[36,["__e_main",[15,"data"]]]],
  [50,"__fm_main",[46,"a"],[41,"b","c"],[38,[17,[15,"a"],"action"],[46,"measure","filter","block"],[46,[5,[46,[3,"b",[39,[17,[15,"a"],"mergeEventParameters"],[17,[15,"a"],"dropParamTable"],[7]]],["__fm_sendFirebaseEvent",[17,[15,"a"],"eventName"],[17,[15,"a"],"editParamTable"],[15,"b"],[17,[15,"a"],"mergeEventParameters"]],[4]]],[5,[46,[3,"c",[30,[17,[15,"a"],"overrideEventName"],[2,[17,[15,"gtmUtils"],"mobile"],"event",[7]]]],["__fm_sendFirebaseEvent",[15,"c"],[17,[15,"a"],"editParamTable"],[17,[15,"a"],"dropParamTable"],true],[2,[17,[15,"gtmUtils"],"mobile"],"suppressPassthrough",[7]],[4]]],[5,[46,[2,[17,[15,"gtmUtils"],"mobile"],"suppressPassthrough",[7]],[4]]],[9,[46,[36]]]]]],[50,"__fm_sendFirebaseEvent",[46,"a","b","c","d"],[41,"e","f","g","h","i","j"],[3,"e",[30,[2,[17,[15,"gtmUtils"],"common"],"tableToMap",[7,[15,"b"],"editParamKey","editParamValue"]],[8]]],[22,[28,["__fm_validateEventData",[15,"a"],[15,"e"]]],[46,[36]]],[3,"f",[7]],[47,"g",[15,"c"],[46,[2,[15,"f"],"push",[7,[16,[16,[15,"c"],[15,"g"]],"dropParamKey"]]]]],[3,"h",[39,[15,"d"],[2,[17,[15,"gtmUtils"],"mobile"],"eventParameters",[7]],[8]]],[3,"h",[30,[15,"h"],[8]]],[47,"i",[15,"e"],[46,[22,[12,[2,[15,"f"],"indexOf",[7,[15,"i"]]],[27,1]],[46,[43,[15,"h"],[15,"i"],[16,[15,"e"],[15,"i"]]]],[46,[2,[17,[15,"gtmUtils"],"common"],"log",[7,"w",[0,[0,"Dropped param ",[15,"i"]]," is also specified in param override table"]]]]]]],[3,"j",[8]],[47,"i",[15,"h"],[46,[22,[12,[2,[15,"f"],"indexOf",[7,[15,"i"]]],[27,1]],[46,[43,[15,"j"],[15,"i"],[16,[15,"h"],[15,"i"]]]]]]],[2,[17,[15,"gtmUtils"],"mobile"],"sendMeasurement",[7,[15,"a"],[15,"j"]]]],[50,"__fm_validateEventData",[46,"a","b"],[41,"c"],[22,[30,[12,[2,[15,"a"],"charAt",[7,0]],"_"],[28,[2,[15,"a"],"match",[7,"^[A-Za-z0-9_]*$"]]]],[46,[2,[17,[15,"gtmUtils"],"common"],"log",[7,"w",[0,[0,[0,"Invalid Event name: ",[15,"a"]]," (Must not start with an underscore and must consist of letters,"]," digits and/or underscores)"]]],[36,false]]],[47,"c",[15,"b"],[46,[22,[30,[12,[2,[15,"c"],"charAt",[7,0]],"_"],[28,[2,[15,"c"],"match",[7,"^[A-Za-z0-9_]*$"]]]],[46,[2,[17,[15,"gtmUtils"],"common"],"log",[7,"w",[0,[0,[0,"Invalid parameter name: ",[15,"c"]]," (Must not start with an underscore and must consist of"]," letters, digits and/or underscores)"]]],[36,false]]]]],[36,true]],[50,"__fm",[46,"data"],[36,["__fm_main",[15,"data"]]]],
  [50,"main",[46,"a"],[43,[17,[15,"a"],"common"],"tableToMap",[15,"tableToMap"]],[43,[17,[15,"a"],"common"],"stringify",[15,"stringify"]]],[50,"tableToMap",[46,"a","b","c"],[41,"d","e","f"],[3,"d",[8]],[3,"e",false],[3,"f",0],[42,[1,[15,"a"],[23,[15,"f"],[17,[15,"a"],"length"]]],[33,[15,"f"],[3,"f",[0,[15,"f"],1]]],false,[46,[22,[1,[1,[16,[15,"a"],[15,"f"]],[2,[16,[15,"a"],[15,"f"]],"hasOwnProperty",[7,[15,"b"]]]],[2,[16,[15,"a"],[15,"f"]],"hasOwnProperty",[7,[15,"c"]]]],[46,[43,[15,"d"],[16,[16,[15,"a"],[15,"f"]],[15,"b"]],[16,[16,[15,"a"],[15,"f"]],[15,"c"]]],[3,"e",true]]]]],[36,[39,[15,"e"],[15,"d"],[45]]]],[50,"stringify",[46,"a"],[41,"b","c","d","e"],[22,[20,[15,"a"],[45]],[46,[36,"null"]]],[22,[20,[15,"a"],[44]],[46,[36,[44]]]],[22,[30,[12,[40,[15,"a"]],"number"],[12,[40,[15,"a"]],"boolean"]],[46,[36,[2,[15,"a"],"toString",[7]]]]],[22,[12,[40,[15,"a"]],"string"],[46,[36,[0,[0,"\"",[2,[2,[15,"a"],"split",[7,"\""]],"join",[7,"\\\""]]],"\""]]]],[22,[2,[17,[15,"gtmUtils"],"common"],"isArray",[7,[15,"a"]]],[46,[3,"b",[7]],[3,"c",0],[42,[23,[15,"c"],[17,[15,"a"],"length"]],[33,[15,"c"],[3,"c",[0,[15,"c"],1]]],false,[46,[3,"d",["stringify",[16,[15,"a"],[15,"c"]]]],[22,[12,[15,"d"],[44]],[46,[2,[15,"b"],"push",[7,"null"]]],[46,[2,[15,"b"],"push",[7,[15,"d"]]]]]]],[36,[0,[0,"[",[2,[15,"b"],"join",[7,","]]],"]"]]]],[22,[12,[40,[15,"a"]],"object"],[46,[3,"b",[7]],[47,"e",[15,"a"],[46,[3,"d",["stringify",[16,[15,"a"],[15,"e"]]]],[22,[29,[15,"d"],[44]],[46,[2,[15,"b"],"push",[7,[0,[0,[0,"\"",[15,"e"]],"\":"],[15,"d"]]]]]]]],[36,[0,[0,"{",[2,[15,"b"],"join",[7,","]]],"}"]]]],[2,[17,[15,"gtmUtils"],"common"],"log",[7,"e","Attempting to stringify unknown type!"]],[36,[44]]]]
  }
  </code></pre>
  
  <p>And container version 4:</p>
  
  <pre><code>{
  
  "fingerprint":"NA$0",
  
  "resource": {
    "version":"4",
    "macros":[
      {
        "function":"__e",
        "instance_name":"Event Name",
        "vendor_template_version":"1"
      },
      {
        "function":"__ai",
        "instance_name":"App ID",
        "vendor_template_version":"1"
      },
      {
        "function":"__an",
        "instance_name":"App Name",
        "vendor_template_version":"1"
      },
      {
        "function":"__av",
        "instance_name":"App Version Code",
        "vendor_template_version":"1"
      }
    ],
    "tags":[
      {
        "function":"__fm",
        "instance_name":"Firebase X Tag",
        "once_per_event":true,
        "vendor_template_version":"1",
        "vtp_overrideEventName":["template",["macro",0],"yy"],
        "vtp_action":"filter",
        "tag_id":2
      }
    ],
    "predicates":[
      {
        "function":"_sw",
        "arg0":["macro",0],
        "arg1":"test"
      }
    ],
    "rules":[
      [["if",0],["add",0]]
    ]
  },
  "runtime":
  [[50,"__ai_main",[46],[36,[2,[17,[15,"gtmUtils"],"mobile"],"applicationId",[7]]]],[50,"__ai",[46,"data"],[36,["__ai_main",[15,"data"]]]],
  [50,"__an_main",[46],[36,[2,[17,[15,"gtmUtils"],"mobile"],"applicationName",[7]]]],[50,"__an",[46,"data"],[36,["__an_main",[15,"data"]]]],
  [50,"__av_main",[46],[36,[2,[17,[15,"gtmUtils"],"mobile"],"applicationVersion",[7]]]],[50,"__av",[46,"data"],[36,["__av_main",[15,"data"]]]],
  [50,"__e_main",[46],[36,[2,[17,[15,"gtmUtils"],"mobile"],"event",[7]]]],[50,"__e",[46,"data"],[36,["__e_main",[15,"data"]]]],
  [50,"__fm_main",[46,"a"],[41,"b","c"],[38,[17,[15,"a"],"action"],[46,"measure","filter","block"],[46,[5,[46,[3,"b",[39,[17,[15,"a"],"mergeEventParameters"],[17,[15,"a"],"dropParamTable"],[7]]],["__fm_sendFirebaseEvent",[17,[15,"a"],"eventName"],[17,[15,"a"],"editParamTable"],[15,"b"],[17,[15,"a"],"mergeEventParameters"]],[4]]],[5,[46,[3,"c",[30,[17,[15,"a"],"overrideEventName"],[2,[17,[15,"gtmUtils"],"mobile"],"event",[7]]]],["__fm_sendFirebaseEvent",[15,"c"],[17,[15,"a"],"editParamTable"],[17,[15,"a"],"dropParamTable"],true],[2,[17,[15,"gtmUtils"],"mobile"],"suppressPassthrough",[7]],[4]]],[5,[46,[2,[17,[15,"gtmUtils"],"mobile"],"suppressPassthrough",[7]],[4]]],[9,[46,[36]]]]]],[50,"__fm_sendFirebaseEvent",[46,"a","b","c","d"],[41,"e","f","g","h","i","j"],[3,"e",[30,[2,[17,[15,"gtmUtils"],"common"],"tableToMap",[7,[15,"b"],"editParamKey","editParamValue"]],[8]]],[22,[28,["__fm_validateEventData",[15,"a"],[15,"e"]]],[46,[36]]],[3,"f",[7]],[47,"g",[15,"c"],[46,[2,[15,"f"],"push",[7,[16,[16,[15,"c"],[15,"g"]],"dropParamKey"]]]]],[3,"h",[39,[15,"d"],[2,[17,[15,"gtmUtils"],"mobile"],"eventParameters",[7]],[8]]],[3,"h",[30,[15,"h"],[8]]],[47,"i",[15,"e"],[46,[22,[12,[2,[15,"f"],"indexOf",[7,[15,"i"]]],[27,1]],[46,[43,[15,"h"],[15,"i"],[16,[15,"e"],[15,"i"]]]],[46,[2,[17,[15,"gtmUtils"],"common"],"log",[7,"w",[0,[0,"Dropped param ",[15,"i"]]," is also specified in param override table"]]]]]]],[3,"j",[8]],[47,"i",[15,"h"],[46,[22,[12,[2,[15,"f"],"indexOf",[7,[15,"i"]]],[27,1]],[46,[43,[15,"j"],[15,"i"],[16,[15,"h"],[15,"i"]]]]]]],[2,[17,[15,"gtmUtils"],"mobile"],"sendMeasurement",[7,[15,"a"],[15,"j"]]]],[50,"__fm_validateEventData",[46,"a","b"],[41,"c"],[22,[30,[12,[2,[15,"a"],"charAt",[7,0]],"_"],[28,[2,[15,"a"],"match",[7,"^[A-Za-z0-9_]*$"]]]],[46,[2,[17,[15,"gtmUtils"],"common"],"log",[7,"w",[0,[0,[0,"Invalid Event name: ",[15,"a"]]," (Must not start with an underscore and must consist of letters,"]," digits and/or underscores)"]]],[36,false]]],[47,"c",[15,"b"],[46,[22,[30,[12,[2,[15,"c"],"charAt",[7,0]],"_"],[28,[2,[15,"c"],"match",[7,"^[A-Za-z0-9_]*$"]]]],[46,[2,[17,[15,"gtmUtils"],"common"],"log",[7,"w",[0,[0,[0,"Invalid parameter name: ",[15,"c"]]," (Must not start with an underscore and must consist of"]," letters, digits and/or underscores)"]]],[36,false]]]]],[36,true]],[50,"__fm",[46,"data"],[36,["__fm_main",[15,"data"]]]],
  [50,"main",[46,"a"],[43,[17,[15,"a"],"common"],"tableToMap",[15,"tableToMap"]],[43,[17,[15,"a"],"common"],"stringify",[15,"stringify"]]],[50,"tableToMap",[46,"a","b","c"],[41,"d","e","f"],[3,"d",[8]],[3,"e",false],[3,"f",0],[42,[1,[15,"a"],[23,[15,"f"],[17,[15,"a"],"length"]]],[33,[15,"f"],[3,"f",[0,[15,"f"],1]]],false,[46,[22,[1,[1,[16,[15,"a"],[15,"f"]],[2,[16,[15,"a"],[15,"f"]],"hasOwnProperty",[7,[15,"b"]]]],[2,[16,[15,"a"],[15,"f"]],"hasOwnProperty",[7,[15,"c"]]]],[46,[43,[15,"d"],[16,[16,[15,"a"],[15,"f"]],[15,"b"]],[16,[16,[15,"a"],[15,"f"]],[15,"c"]]],[3,"e",true]]]]],[36,[39,[15,"e"],[15,"d"],[45]]]],[50,"stringify",[46,"a"],[41,"b","c","d","e"],[22,[20,[15,"a"],[45]],[46,[36,"null"]]],[22,[20,[15,"a"],[44]],[46,[36,[44]]]],[22,[30,[12,[40,[15,"a"]],"number"],[12,[40,[15,"a"]],"boolean"]],[46,[36,[2,[15,"a"],"toString",[7]]]]],[22,[12,[40,[15,"a"]],"string"],[46,[36,[0,[0,"\"",[2,[2,[15,"a"],"split",[7,"\""]],"join",[7,"\\\""]]],"\""]]]],[22,[2,[17,[15,"gtmUtils"],"common"],"isArray",[7,[15,"a"]]],[46,[3,"b",[7]],[3,"c",0],[42,[23,[15,"c"],[17,[15,"a"],"length"]],[33,[15,"c"],[3,"c",[0,[15,"c"],1]]],false,[46,[3,"d",["stringify",[16,[15,"a"],[15,"c"]]]],[22,[12,[15,"d"],[44]],[46,[2,[15,"b"],"push",[7,"null"]]],[46,[2,[15,"b"],"push",[7,[15,"d"]]]]]]],[36,[0,[0,"[",[2,[15,"b"],"join",[7,","]]],"]"]]]],[22,[12,[40,[15,"a"]],"object"],[46,[3,"b",[7]],[47,"e",[15,"a"],[46,[3,"d",["stringify",[16,[15,"a"],[15,"e"]]]],[22,[29,[15,"d"],[44]],[46,[2,[15,"b"],"push",[7,[0,[0,[0,"\"",[15,"e"]],"\":"],[15,"d"]]]]]]]],[36,[0,[0,"{",[2,[15,"b"],"join",[7,","]]],"}"]]]],[2,[17,[15,"gtmUtils"],"common"],"log",[7,"e","Attempting to stringify unknown type!"]],[36,[44]]]]
  }
  </code></pre>